/* Copyright 2014-2022 © Moxie Software. All Rights Reserved. Concierge Version: v1.33.1 */ !function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,i=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function Y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n2?n-2:0),r=2;r0){for(var n=arguments.length,i=new Array(n>2?n-2:0),r=2;r2&&void 0!==arguments[2]?arguments[2]:0,i=e.length>>>0;n<0&&(n+=i),n<0&&(n=0);for(var r=n;r>>0,i=0;i=0;--a){var o=this.tryEntries[a],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var c=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(c&&u){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),x(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var r=i.arg;x(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,i){return this.delegate={iterator:A(e),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=t),p}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"===("undefined"==typeof globalThis?"undefined":i(globalThis))?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}({exports:{}}),F.resolve();var ie=Object.prototype.toString;function re(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ae(e){var t=i(e);return null!==e&&("object"===t||"function"===t)}function oe(e){return null==e}var se=function(){try{return Symbol.iterator?Symbol.iterator:"Symbol(Symbol.iterator)"}catch(e){return"Symbol(Symbol.iterator)"}}();function ce(e){return"function"==typeof(t=e[se])||"[object Function]"===ie.call(t);var t}function ue(e,t){return e===t}function le(e){return JSON.stringify(e)}function de(e){if(oe(e))return"";switch(i(e)){case"string":return e;case"object":return le(e);case"symbol":return e.description;default:return String(e)}}function ge(e){var t=0;if("string"==typeof e&&(t=Number(e),e=isNaN(t)?Date.parse(e):t),"number"==typeof e&&e<9999999999&&(e*=1e3),"object"===i(e)){if(e instanceof Date)return t=e.getTime(),e.getTime();throw Error("unsupported type:"+e)}return e}function fe(e,t){return function(e,t){return e=ge(e),t?e-ge(t):Date.now()-e}(e,t)/1e3}function he(){return{events:{},dispatch:function(e){var t=this.events[e];if(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r2?i-2:0),a=2;a2?i-2:0),a=2;a1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i1?n-1:0),r=1;r1?n-1:0),r=1;r1?n-1:0),r=1;r1?n-1:0),r=1;r1?n-1:0),r=1;r2&&void 0!==arguments[2]?arguments[2]:0;return e.indexOf(t,n)===n}function Ce(e,t,n){var i=e.toString();(void 0===n||n>i.length)&&(n=i.length),n-=t.length;var r=i.indexOf(t,n);return-1!==r&&r===n}function ke(e){return de(e).trim()}var Ee=function(){function t(n){e(this,t),this.el=n}return n(t,[{key:"tokens",value:function(){return void 0===this.list&&(this.list=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";return e?e.split(t).filter(Boolean):[]}(we(this.el,"class"))),this.list}},{key:"commit",value:function(){ye(this.el,"class",this.tokens().join(" "))}},{key:"contains",value:function(e){return this.tokens().indexOf(e)>=0}},{key:"add",value:function(){for(var e=this.tokens(),t=!1,n=arguments.length,i=new Array(n),r=0;r=0;)e.splice(c,1),t=!0,c=e.indexOf(s,c);t&&this.commit()}}]),t}();function Ie(e){return void 0===e.classList?new Ee(e):e.classList}function _e(e,t){return Ie(e).contains(t)}function Oe(e){for(var t,n=arguments.length,i=new Array(n>1?n-1:0),r=1;r1?n-1:0),r=1;r=0){if(0===n)return e;if(0===t&&1===n)return e;if(n>t)return[e[t]]}return[]}function Fe(e){return function(e,t){for(var n=[],i=arguments.length,r=new Array(i>2?i-2:0),a=2;a1&&(e.clean=!1),e.selectors.push(n)}function qe(e){var t={clean:!0,selector:e,selectors:[]};if(e.indexOf(",")>=0){var n,i=Q(e.split(","));try{for(i.s();!(n=i.n()).done;){Ve(t,n.value)}}catch(e){i.e(e)}finally{i.f()}}else Ve(t,e);return t}function Be(e,t){return function(e,t){var n=t[1];if(!n)return e;switch(n){case"eq":return je(e,Number(t[2]));case"first":return je(e,0);case"last":return function(e){var t=e.length;return t>1?[e[t-1]]:e}(e);case"visible":return Fe(e)}}(Pe(e,t[0]),t)}function He(e,t){var n=t.selectors.length;if(n>1){var i,r=[],a=Q(t.selectors);try{for(a.s();!(i=a.n()).done;){ne(r,Be(e,i.value))}}catch(e){a.e(e)}finally{a.f()}return r}return 1===n?Be(e,t.selectors[0]):[]}function $e(e){return function(e,t){return(t=t.trim())?He(e,qe(t)):[]}(document,e)}function Ue(e){De(e)&&(e.remove?e.remove():e.parentNode.removeChild(e))}function Je(e,t){e.innerHTML=t}function Ge(e,t,n){e.insertAdjacentHTML(t,n)}function ze(e,t){Ge(e,"afterbegin",t)}function Ke(e,t){Ge(e,"beforeend",t)}function Xe(e,t){!function(e,t){Ge(e,"afterend",t)}(e,t),Ue(e)}function Qe(e){Z(e.childNodes,Ue)}function Ye(e,t){e.appendChild(t)}function Ze(e,t){e.childNodes.length>0?e.insertBefore(t,e.childNodes[0]):Ye(e,t)}function et(e){e.focus()}function tt(e){e.blur()}function nt(e,t){return e===t||!!t.parentNode&&nt(e,t.parentNode)}function it(e){return nt(e.ownerDocument,e)}function rt(e,t){return e.tagName===t}function at(e,t){return e.attributes&&null!==we(e,t)}function ot(e,t){try{return(e.matches||e.msMatchesSelector).call(e,t)}catch(e){return me.error("ERROR: ".concat(e.message)),!1}}function st(e,t){return t.clean?ot(e,t.selector):te(He(document,t),e)>=0}function ct(e){return void 0!==e.parentElement?e.parentElement:De(e)?e.parentNode:null}var ut={value:"",text:""};function lt(e){if(e){if(e instanceof HTMLSelectElement){var t=e.selectedIndex;return t>=0?lt(e.options[t]):ut}if(function(e){return e instanceof HTMLOptionElement}(e))return{value:e.value,text:e.text};if(function(e){return e instanceof HTMLTextAreaElement}(e)){var n=e.value;return{value:n,text:n}}if(function(e){return e instanceof HTMLInputElement}(e)){var i=e.value;return{value:i,text:i}}var r=e.textContent||"";return{value:r,text:r}}return ut}function dt(e){return e.value||e.text}function gt(){return window.innerHeight}function ft(){return window.innerWidth}function ht(){return gt()>window.visualViewport.height}function vt(e){return isFinite(Number(e))?"".concat(e,"px"):String(e)}var pt={top:vt,bottom:vt,left:vt,right:vt,height:vt,width:vt};function mt(e){var t=(e=String(e)).indexOf("px");return t>0&&(e=Number(e.slice(0,t))),e}var wt={top:mt,bottom:mt,left:mt,right:mt,height:mt,width:mt};function yt(e,t){var n=pt[e];return n?n(t):t}function bt(e,t){var n=wt[e];return n?n(t):t}function St(e){return e.getBoundingClientRect()}function Ct(e){var t=St(e);return{top:t.top+document.body.scrollTop,left:t.left+document.body.scrollLeft}}function kt(e){return getComputedStyle(e,null)}function Et(e){var t=mt(kt(e).height);return""!==t&&"auto"!==t||(t=St(e).height),Number(t)}function It(e){var t=mt(kt(e).width);return""!==t&&"auto"!==t||(t=St(e).width),Number(t)}function _t(e){var t=kt(e);if("none"==t.display)return!1;if("hidden"==t.visibility)return!1;var n=ct(e);return!n||_t(n)}function Ot(e,t,n,i){e.addEventListener(t,n,i)}function xt(e,t,n){Ot(e,t,n,!1)}var Tt=void 0;function At(e,t,n){if(void 0===Tt)try{var i=function(){};Ot(window,"click",i,{get passive(){return Tt=!0,!1}}),Dt(window,"click",i)}catch(e){Tt=!1}Ot(e,t,n,!!Tt&&{passive:!0})}function Dt(e,t,n){e.removeEventListener(t,n)}function Nt(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i4&&void 0!==arguments[4]&&arguments[4],o=function(e){var t=n(e),o=t[0],s=t[1];o&&(null===s&&(s=r),!1===i.bind(s)(e)&&(e.stopPropagation(),a||e.preventDefault()))};return Z(e,a?At:xt,t,o),o}function Wt(e,t,n){Z(e,Dt,t,n)}function Rt(e){return Nt(_e,e)}function Pt(e){return Nt(rt,e.toUpperCase())}function jt(e){var t=qe(e);return t.clean?Nt(ot,t.selector):Nt(st,t)}function Ft(e){for(var t=[],n=!1,i=0;i!==e.length;i++){var r=e[i];"-"===r?n=!0:n?(t.push(r.toUpperCase()),n=!1):t.push(r)}return t.join("")}function Vt(e){return encodeURIComponent(e)}var qt=Date.now()%1e9;var Bt=!1||"undefined"==typeof WeakMap?new(function(){function t(){e(this,t),this.n="__stash_"+(1e9*Math.random()>>>0)+qt+++"__"}return n(t,[{key:"set",value:function(e,t){var n=e[this.n];return n&&n[0]===e?n[1]=t:Object.defineProperty(e,this.n,{value:[e,t],writable:!0}),this}},{key:"get",value:function(e){var t=e[this.n];return t&&t[0]===e?t[1]:void 0}},{key:"delete",value:function(e){var t=e[this.n];if(!t)return!1;var n=t[0]===e;return t[0]=t[1]=void 0,n}},{key:"has",value:function(e){var t=e[this.n];return!!t&&t[0]===e}}]),t}()):new WeakMap;function Ht(e){var t;return Bt.has(e)?t=Bt.get(e):(t={},Bt.set(e,t)),t}function $t(e,t,n){var i=Ht(e),r=i[t];return i[t]=n,r}function Ut(e,t){return Ht(e)[t]}function Jt(e,t){delete Ht(e)[t]}function Gt(e,t){var n=Ut(e,t);return void 0===n&&(n=we(e,"data-"+function(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}(t))),n}function zt(e){for(var t=wn({},Ht(e)),n=e.attributes,i=n.length,r=0;r0&&("<"===n.charAt(0)?this.pushAll(rn(n)):this.pushAll(Pe(document,n))):t.isArrayLike(n)?this.pushAll(n):this.push(n))}return n(t,[{key:"push",value:function(e){return e&&e.nodeType===Ne&&(this[this.length]=e,this.length+=1),this}},{key:"pushAll",value:function(e){for(var t=0;t1?t-1:0),i=1;i0&&_e(this[0],e)}},{key:"attr",value:function(e,t){var n=arguments.length;if(2===n)Z(this,ye,e,t);else if(1===n){var i=this.length>0?we(this[0],e):null;return null!==i?i:void 0}return this}},{key:"removeAttr",value:function(e){return Z(this,be,e),this}},{key:"data",value:function(e,t){var n=arguments.length;if(2===n)Z(this,$t,e,t);else{if(1===n)return 0===this.length?void 0:Gt(this[0],e);if(0===n)return 0===this.length?void 0:zt(this[0])}return this}},{key:"addClass",value:function(e){return function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i1?t-1:0),i=1;i0){var r=i(e);if(1===n){if("string"===r)return this.length>0?kt(this[0])[Ft(e)]:null;if(Array.isArray(e)){for(var a={},o=kt(this[0]),s=0;s0&&(n=e[0]):n=e,n&&Z(this,(function(e){Ye(n,e)})),this}},{key:"html",value:function(e){return Z(this,Je,e),this}},{key:"val",value:function(){return this.length>0?this[0].value||null:void 0}},{key:"text",value:function(e){var t=arguments.length;if(0===t){var n=[];return Z(this,(function(e){e.textContent&&n.push(e.textContent)})),n.join("")}return 1===t&&this.length>0&&(this[0].textContent=e),this}},{key:"prependHtml",value:function(e){return Z(this,ze,e),this}},{key:"remove",value:function(){return Z(this,Ue),this}},{key:"find",value:function(e){var n=new t;return Z(this,(function(t){n.pushAll(Pe(t,e))})),n}},{key:"closest",value:function(e){var n=new t;return Z(this,(function(t){n.push(function(e,t){if(Element.prototype.closest)return e.closest(t);var n=e;do{if(ot(n,t))return n;n=ct(n)}while(null!==n&&n.nodeType===Ne);return null}(t,e))})),n}},{key:"first",value:function(){var e=new t;return this.length>0&&e.push(this[0]),e}},{key:"parent",value:function(){var e=new t;return this.length>0&&e.push(this[0].parentNode),e}},{key:"children",value:function(e){var n=new t;return Z(this,(function(e){var t=e.childNodes;n.pushAll(t)})),e&&(n=n.filter(e)),n}},{key:"index",value:function(){return this.length>0?function(e){var t=e.parentNode.childNodes,n=0;for(n=0;n0?Et(this[0]):0:(Z(this,Xt,{height:"".concat(e,"px")}),this)}},{key:"width",value:function(e){return 0===arguments.length?this.length>0?It(this[0]):0:(Z(this,Xt,{width:"".concat(e,"px")}),this)}},{key:"sort",value:function(e){var t=mn(this);t.sort(e);for(var n=0;n=0&&i>=0;if(1===t.length)return parseFloat(t[0]);var a=t.slice(0,-1).join(""),o=t.slice(-1).join("");return r||n>i?parseFloat(a+"."+o):i>n&&3===o.length?"0"===a?parseFloat(a+"."+o):parseFloat(a+o):parseFloat(a+"."+o)}function ln(e){var t=ke(e).toLowerCase();if(Ce(t,"%"))return un(t.slice(0,-1))/100;var n=t.lastIndexOf("e");if(n>0){var i=t.slice(n+1);return Number("".concat(un(t.slice(0,n)),"e").concat(i))}return un(t)}function dn(e,t){return de(e.value).indexOf(t)>=0||de(e.text).indexOf(t)>=0}var gn={none:function(e,t){return!0},startsWith:function(e,t){return Se(ke(e.value),t)||Se(ke(e.text),t)},endsWith:function(e,t){return Ce(ke(e.value),t)||Ce(ke(e.text),t)},contains:dn,notContains:function(e,t){return!dn(e,t)},matches:function(e,t){try{var n=new RegExp(t);return n.test(de(e.value))||n.test(de(e.text))}catch(n){return ke(e.value)===t||ke(e.text)===t}},lessThan:function(e,t){return ln(dt(e))t},equalTo:function(e,t){return t==ln(dt(e))},notEqualTo:function(e,t){return t!=ln(dt(e))}};function fn(e,t,n,i){return function(r){var a=r.target;a instanceof HTMLElement&&function(e,t,n){if("none"==t)return!0;for(var i=gn[t],r=lt(e),a=n.length,o=0;o1?n-1:0),r=1;r=0&&(a.addEventListener("loadstart",(function(){o=setTimeout((function(){o=!1,a.abort(),i(new Error("Operation timed out"))}),n.timeout)})),a.addEventListener("loadend",(function(){o&&clearTimeout(o)}))),a.addEventListener("load",(function(){a.status>=200&&a.status<400?e(a):i(new bn(a,Date.now()-r))})),a.addEventListener("error",(function(){i(new bn(a,Date.now()-r))})),a.send()})),e.cache[t]=i,n.retainFor>0){var o=setTimeout(r,n.retainFor);e.retainTimeouts[t]=o}i.catch((function(){return r(),null}))}return i}var En=function(){function t(){var n=this;e(this,t),this.cache={},this.retainTimeouts={},this.get=function(e,t){return n.getXMLHttpRequest(e,Sn(n.defaults,t)).then((function(e){return"string"==typeof e.response?JSON.parse(e.response):e.response}))},this.set=function(e,t){n.cache[e]=F.resolve(t)},this.getXMLHttpRequest=function(e,t){return kn(n,e,Sn(n.defaults,t))},this.defaults=function(e){for(var t=1;t=0&&(this.defaults.retainFor=t),this.defaults.retainFor}},{key:"timeout",value:function(e){var t=Number(e);return t>=0&&(this.defaults.timeout=t),this.defaults.timeout}},{key:"urls",value:function(){return Object.keys(this.cache)}},{key:"remove",value:function(e){delete this.cache[e],this.retainTimeouts[e]&&(clearTimeout(this.retainTimeouts[e]),delete this.retainTimeouts[e])}},{key:"clear",value:function(){for(var e in this.retainTimeouts)clearTimeout(this.retainTimeouts[e]);this.cache={},this.retainTimeouts={}}}]),t}(),In="function"==typeof CustomEvent?function(e,t){return new CustomEvent(e,{detail:t})}:function(e,t){var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,!1,!1,t),n};function _n(e,t,n){var i=In("GoMoxie:"+e,t);return i.version=n,i}var On={kb:1,chat:2,email:3,kbot:2,link:4,"cxone-expert":1,"dfo-live":2,customChannel:5},xn={_blank:1,_self:2},Tn="Desktop",An="Tablet",Dn="Mobile",Nn=Tn;function Mn(e){var t=e.userAgent;return t.match(/GoogleTV|SmartTV|Internet.TV|NetCast|NETTV|AppleTV|boxee|Kylo|Roku|DLNADOC|CE-HTML/i)||t.match(/Xbox|PLAYSTATION.3|Wii/i)?Nn:t.match(/Windows.(NT|XP|ME|9)/)&&!t.match(/Phone/i)||t.match(/Win(9|.9|NT)/i)?Tn:t.match(/iPad/i)||t.match(/tablet/i)&&!t.match(/RX-34/i)||t.match(/FOLIO/i)||t.match(/Linux/i)&&t.match(/Android/i)&&!t.match(/Fennec|mobi|HTC.Magic|HTCX06HT|Nexus.One|SC-02B|fone.945/i)||t.match(/Kindle/i)||t.match(/Mac.OS/i)&&t.match(/Silk/i)||t.match(/GT-P10|SC-01C|SHW-M180S|SGH-T849|SCH-I800|SHW-M180L|SPH-P100|SGH-I987|zt180|HTC(.Flyer|_Flyer)|Sprint.ATP51|ViewPad7|pandigital(sprnova|nova)|Ideos.S7|Dell.Streak.7|Advent.Vega|A101IT|A70BHT|MID7015|Next2|nook/i)||t.match(/MB511/i)&&t.match(/RUTEM/i)?An:t.match(/BOLT|Fennec|Iris|Maemo|Minimo|Mobi|mowser|NetFront|Novarra|Prism|RX-34|Skyfire|Tear|XV6875|XV6975|Google.Wireless.Transcoder/i)||t.match(/Opera/i)&&t.match(/Windows.NT.5/i)&&t.match(/HTC|Xda|Mini|Vario|SAMSUNG-GT-i8000|SAMSUNG-SGH-i9/i)?Dn:t.match(/Macintosh|PowerPC/i)&&!t.match(/Silk/i)||t.match(/Linux/i)&&t.match(/X11/i)||t.match(/Solaris|SunOS|BSD/i)||t.match(/Bot|Crawler|Spider|Yahoo|ia_archiver|Covario-IDS|findlinks|DataparkSearch|larbin|Mediapartners-Google|NG-Search|Snappy|Teoma|Jeeves|TinEye/i)&&!t.match(/Mobile/i)||t.match(/CrOS/i)?Tn:Dn}var Ln="uuid",Wn="moxie_cc",Rn="Rules",Pn=7,jn=8,Fn="profileJSON",Vn="engagementWidgets",qn="MoxieCache_visitorProfile_lastUpdated",Bn="moxie_channels_custom_data",Hn="moxie_channels_form_data",$n="rules_version",Un="widgets_version",Jn="engagement_id",Gn="moxie_concierge_event_serial_number",zn=4294967295,Kn="SharedStorage",Xn="window.name",Qn="externalAPI",Yn="externalLink",Zn={chat:1,kb:2,email:3,kbot:4},ei="drag_position",ti="concierge-widget-area",ni="dfo-live",ii="online",ri=0;function ai(e){switch(e){case 1:return"kb";case 2:return"chat";case 3:return"email";case 4:return"link";case 5:return"kbot";case 6:return"cxone-expert";case 7:return"dfo-live";case 8:return"customChannel";default:me.error("Unknown widget value:",e)}}function oi(e,t,n){return 4===e?6:1===e?1002===t||1001===t?isNaN(ln(n))?16:ri:2===t||13===t||9===t?ri:16:e}function si(e){return-1!==[ri,Pn,jn].indexOf(e)}function ci(e,t,n){return si(t)?function(e,t,n){if("number"==typeof e&&!isNaN(e)&&"number"==typeof n&&!isNaN(n))switch(t){case ri:return e===n;case Pn:return e2&&void 0!==arguments[2]?arguments[2]:0;return-1!==e.indexOf(t,n)}(e,n);case 16:return e===n;case 3:return Ce(e,n);case 5:return null!==e.match(n);default:return!1}}(e,t,n)}function ui(e,t,n,i){void 0===i&&(i=!0);var r=0;switch(t){case 0:r=0;break;case 1:r=e.journey.length-1;break;case 2:n||(n=2),(e.journey.length>n||!1===i)&&(r=e.journey.length-n)}return e.journey[r]}function li(e,t,n,i){void 0===i&&(i=!0);var r=0;switch(t){case 0:r=0;break;case 1:r=e.session.visits.length-1;break;case 2:n||(n=2),(e.session.visits.length>n||!1===i)&&(r=e.session.visits.length-n)}return e.session.visits[r]}function di(e){return void 0===e?e:JSON.parse(JSON.stringify(e))}function gi(e,t,n){e&&e[t]!==n&&(e[t]=n,e.dirty=!0)}var fi=String.prototype.valueOf,hi=Object.prototype.toString,vi="function"==typeof Symbol&&"symbol"===i(Symbol.toStringTag);function pi(e){return"string"==typeof e||"object"===i(e)&&(vi?function(e){try{return fi.call(e),!0}catch(e){return!1}}(e):"[object String]"===hi.call(e))}function mi(e){var t=new Set;if(null!=e)for(var n=0;n!==e.length;n++)t.add(e[n]);return t}var wi={name:"n",value:"V",quantity:"q",skuOrId:"s",uom:"u"};function yi(e){return function(){try{return e.apply(this,arguments)}catch(e){me.error(e)}}}function bi(e,t){var n,i,r,a,o;if(e&&e.rulesEngine&&e.rulesEngine.siteRules&&e.rulesEngine.siteRules.rules)e:for(i=0;i=1)}(e))return e;if(o=e.session.visits.length-1,a=e.session.visits[o].journey.length-1,void 0!==t.currentCartValue&&(r=Number(t.currentCartValue),isNaN(r)||(e.session.visits[o].journey[a].current_cart_value=r,c.cartValue=r)),void 0!==t.currentCartItems&&(i=(u=t.currentCartItems)&&u.length>0?u.filter((function(e){if("name"in e&&""!==e.name||"sku_or_id"in e&&""!==e.sku_or_id)return!0})):[],e.session.visits[o].journey[a].current_cart_items=i,c.cartItems=i),void 0!==t.transactionTotal&&(s=Number(t.transactionTotal),isNaN(s)||(e.session.end_cart_value=s)),e.last_updated=Date.now(),c.cartValue||c.cartItems){var l=c.cartValue||r,d=c.cartItems||i;tr("cartUpdated",{cartValue:l,cartItems:d}),ji(n,l,d)}return e}function ir(e){return-1!==["link"].indexOf(e)}function rr(e,t){return new F((function(n,i){n(void 0===t?e():e.call(t))}))}function ar(e){return function(){var t=this,n=[].slice.call(arguments,0);return new F((function(i){i(e.apply(t,n))}))}}function or(e){try{var t=window[e],n="__test__";return t.setItem(n,n),t.removeItem(n),!0}catch(e){return!1}}var sr=new Array(16);for(var cr,ur,lr=[],dr=0;dr<256;++dr)lr[dr]=(dr+256).toString(16).substr(1);var gr=0,fr=0;function hr(e,t,n){var i=t&&n||0,r=t||[],a=(e=e||{}).node||cr,o=void 0!==e.clockseq?e.clockseq:ur;if(null==a||null==o){var s=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),sr[t]=e>>>((3&t)<<3)&255;return sr}();null==a&&(a=cr=[1|s[0],s[1],s[2],s[3],s[4],s[5]]),null==o&&(o=ur=16383&(s[6]<<8|s[7]))}var c=void 0!==e.msecs?e.msecs:(new Date).getTime(),u=void 0!==e.nsecs?e.nsecs:fr+1,l=c-gr+(u-fr)/1e4;if(l<0&&void 0===e.clockseq&&(o=o+1&16383),(l<0||c>gr)&&void 0===e.nsecs&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");gr=c,fr=u,ur=o;var d=(1e4*(268435455&(c+=122192928e5))+u)%4294967296;r[i++]=d>>>24&255,r[i++]=d>>>16&255,r[i++]=d>>>8&255,r[i++]=255&d;var g=c/4294967296*1e4&268435455;r[i++]=g>>>8&255,r[i++]=255&g,r[i++]=g>>>24&15|16,r[i++]=g>>>16&255,r[i++]=o>>>8|128,r[i++]=255&o;for(var f=0;f<6;++f)r[i+f]=a[f];return t||function(e,t){var n=t||0,i=lr;return[i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]]].join("")}(r)}function vr(e){return!0===e?"p":"s"}function pr(e){if(void 0!==e)try{return JSON.parse(e)}catch(t){return e}}var mr=function(){function t(){e(this,t),this.name="DefaultStoragePlugin",this.data={p:{},s:{}}}return n(t,[{key:"destroy",value:function(){}},{key:"clear",value:function(){this.data.p={},this.data.s={}}},{key:"has",value:function(e,t){return re(this.data[vr(t)],e)}},{key:"set",value:function(e,t,n){this.data[vr(n)][e]=t}},{key:"del",value:function(e,t){delete this.data[vr(t)][e]}},{key:"get",value:function(e,t){var n=vr(t);return re(this.data[n],e)?pr(this.data[n][e]):null}},{key:"removeKeysOtherThan",value:function(e,t){var n;n=t?this.data.p:this.data.s;var i=Object.keys(n);if(0!==i.length)for(var r=mi(e),a=0;a!==i.length;a++){var o=i[a];r.has(o)||delete n[o]}}}]),t}(),wr=["rules_version","uuid","widgets_version"],yr=["chat-","conclient_","email-","kbot-","kb-","MoxieCache_","moxie","cxone-expert-"];function br(e){if(te(wr,e,0)>=0)return!0;for(var t=0;t=0))if(!0===n)try{localStorage.setItem(e,le(t))}catch(t){me.log("Error setting "+e+": "+t)}else try{sessionStorage.setItem(e,le(t))}catch(t){me.log("Error setting "+e+": "+t)}}},{key:"get",value:function(e,t){if(this.parentStorage.has(e,t))return this.parentStorage.get(e,t);var n=!0===t?localStorage.getItem(e):sessionStorage.getItem(e);return null!==n&&(n=pr(n)),n}},{key:"del",value:function(e,t){this.parentStorage.del(e,t),!0===t?localStorage.removeItem(e):sessionStorage.removeItem(e)}},{key:"clear",value:function(){this.parentStorage.clear(),Sr(localStorage),Sr(sessionStorage)}},{key:"removeKeysOtherThan",value:function(e,t){var n;this.parentStorage.removeKeysOtherThan(e,t);for(var i=Cr(n=t?localStorage:sessionStorage,e),r=0;r!==i.length;r++){var a=i[r];n.removeItem(a)}}}]),t}(),Er="moxie=",Ir=Er.length,_r="!--moxie",Or=_r.length,xr=window.top||window;function Tr(e){var t="",n="",i=e.indexOf(Er);if(i>=0){i>0&&(t=e.slice(0,i));var r=e.indexOf(_r,i+Ir);r>=0?(n=e.slice(i+Ir,r),t+=e.slice(r+Or)):n=e.slice(Er.length)}return[t,n]}function Ar(e){var t=Tr(xr.name||"");xr.name=t[0]+Er+JSON.stringify(e)+_r}var Dr=function(){function t(n,i){e(this,t),this.name="WindowNameStoragePlugin",this.parentStorage=n,this.clientName=i.clientName,this._data=function(e){var t=Tr(xr.name||"")[1],n={};if(t.length>0)try{n=JSON.parse(t)}catch(e){me.log("JSON: unable to parse window.name value:",t)}return n[e]||(n[e]={p:{},s:{}}),n}(this.clientName);var r,a=this;this.saveItListener||(this.saveItListener=function(){Ar(a._data)},xr.addEventListener("unload",this.saveItListener,!1));var o=a._data[this.clientName];for(r in o.p)n.set(r,o.p[r],!0);for(r in o.s)n.set(r,o.s[r],!1)}return n(t,[{key:"destroy",value:function(){this.parentStorage.destroy(),this.saveItListener&&(xr.removeEventListener("unload",this.saveItListener),delete this.saveItListener)}},{key:"has",value:function(e,t){return this.parentStorage.has(e,t)}},{key:"set",value:function(e,t,n){if(this.parentStorage.set(e,t,n),!this.skipSaveForKey||!this.skipSaveForKey(e)){var i=!1;!0===n?(this._data[this.clientName].p[e]!==t&&(i=!0),this._data[this.clientName].p[e]=t):(this._data[this.clientName].s[e]!==t&&(i=!0),this._data[this.clientName].s[e]=t),i&&Ar(this._data)}}},{key:"get",value:function(e,t){var n=!0===t?this._data[this.clientName].p[e]:this._data[this.clientName].s[e];if(void 0!==n)try{return JSON.parse(n)}catch(e){return n}return this.parentStorage.has(e,t)?(n=this.parentStorage.get(e,t),this.skipSaveForKey&&this.skipSaveForKey(e)||(!0===t?this._data[this.clientName].p[e]=n:this._data[this.clientName].s[e]=n,Ar(this._data)),n):null}},{key:"del",value:function(e,t){this.parentStorage.del(e,t),!0===t?delete this._data[this.clientName].p[e]:delete this._data[this.clientName].s[e],Ar(this._data)}},{key:"clear",value:function(){this.parentStorage.clear(),this._data[this.clientName].p={},this._data[this.clientName].s={},Ar(this._data)}}]),t}();function Nr(e){var t=e.widgetManager,n=e.cacheManager;return e._clearingHistoryPromise||(e._clearingHistoryPromise=F.resolve(!0).then((function(){return e.contextMonitor.stop(),t.clearHistory().then((function(){t.destroy()})).then((function(){var t=e.eventService;return e.eventService={clearHistoryStub:!0,notifyEventServiceImmediately:function(){},notifyEventService:function(){}},F.resolve(t.stopEventService())})).then((function(){return F.resolve(n.storagePlugin.clear()).then((function(){n.destroy(),e.cacheManager=null}))})).catch((function(e){throw me.log("History.clearHistory received an error:",e),e}))}))),e._clearingHistoryPromise}function Mr(e){var t=e.userAgent.toString().toLowerCase(),n=e.appName,i=/(dolfin)[ /]([\w.]+)/.exec(t)||/(javafx)[/]([\w.]+)/.exec(t)||/(chrome)[ /]([\w.]+)/.exec(t)||/(opera)(?:.*version)?[ /]([\w.]+)/.exec(t)||/(webkit)(?:.*version)?[ /]([\w.]+)/.exec(t)||/(msie) ([\w.]+)/.exec(t)||t.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(t)||["","unknown"];return"webkit"===i[1]?i=/fbav|instagram/.test(t)&&/(iphone|ipad|ipod)/.test(t)?[i[0],"safari",i[2]]:/(iphone|ipad|ipod)\/?\s*(\.?\d+(\.\d+)*)/.exec(t)||/(android)[ /]([\w._-]+);/.exec(t)||[i[0],"safari",i[2]]:"mozilla"===i[1]?/trident/.test(t)?i[1]="MSIE":i[1]="firefox":/polaris|natebrowser|([010|011|016|017|018|019]{3}\d{3,4}\d{4}$)/.test(t)&&(i[1]="Polaris"),[i[1].toLowerCase(),"unknown"===i[2]?[n,window.navigator.appVersion,"-?"]:i[2]]}var Lr={},Wr=0,Rr={},Pr=0,jr={},Fr={};var Vr=!1;function qr(){Vr||(me.error("Double load of concierge suspected"),Vr=!0)}function Br(e,t){var n=++Pr;return t.bridgeName="storage_bridge",t.requesterId=e.id,t.requestId=n,t.client=e.concierge.clientName,t.signature="moxie_concierge",e&&e.ifrm&&e.ifrm.contentWindow&&e.ifrm.contentWindow.postMessage?(function(){if("function"==typeof window.CustomEvent)return!1;window.CustomEvent=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:null};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}}(),e.ifrm.contentWindow.postMessage(JSON.stringify(t),"*"),new F((function(i,r){var a=setTimeout((function(){if(a=!1,r(new Error("TIMEOUT waiting for shared storage.")),e.concierge.isTestMode){var t=new CustomEvent("stopWriting");document.dispatchEvent(t)}}),6e3);if(e.concierge.isTestMode){var o=new CustomEvent("storagePost");document.dispatchEvent(o)}var s=function(){a&&(clearTimeout(a),a=!1)};jr[n]={message:t,resolve:function(e){s(),i(e)},reject:function(e){s(),r(e)}}})).finally((function(){delete jr[n]}))):(qr(),F.resolve(!0))}function Hr(e,t){this.useSharedStorage=!1,this.parentStorage=e,this.concierge=t,this.scriptLocation=t.scriptLocation,this.created=Date.now(),this.sharedStorageId=function(e){var t=Rr[e];return t||(t="concierge-shared-storage",++Wr>1&&(t=t+"-"+Wr),Rr[e]=t),t}(this.scriptLocation),this.id=Date.now()}function $r(e){this.name="InvalidArgumentException",this.message=e,this.toString=function(){return this.name+": "+this.message}}function Ur(e){return Ce(e,"_file")&&e.indexOf(Fn)<0||e===Rn||e===Vn}function Jr(e,t,n,i){return F.resolve(e.storagePlugin.set(t,n,i))}Hr.prototype.destroy=function(e){e&&this.parentStorage.destroy(),Ue(this.ifrm),this.removeListener?(this.removeListener(),delete this.ifrm):qr()},Hr.prototype.init=function(){var e=this;if(Lr[this.id]=this,this.data={p:{},s:{}},e.ifrm=Me(e.sharedStorageId),!e.ifrm){e.ifrm=document.createElement("iframe"),e.ifrm.setAttribute("id",e.sharedStorageId),e.ifrm.setAttribute("tabindex","-1");var t=e.scriptLocation+"/client/storage_bridge.html";e.ifrm.setAttribute("src",t),e.ifrm.setAttribute("sandbox","allow-scripts allow-same-origin");var n=function(t){if("."===e.scriptLocation||0===e.scriptLocation.indexOf(t.origin)){var n={};try{n="string"==typeof t.data?JSON.parse(t.data):t.data}catch(e){}if(n&&"storage_bridge"===n.bridgeName){var i,r,a,o=e;if(n.requesterId&&Lr[n.requesterId]&&(o=Lr[n.requesterId]),n.requesterId===o.id)n.error?(i=n.requestId,r=new Error("Error from shared storage: "+n.error.message),(a=jr[i])?a.reject(r):me.log("SharedStorageBridge: rejectRequest("+i+", "+JSON.stringify(r)+") cannot find outstanding request")):"updated"===n.request?(me.log("CONCIERGE StoragePlugin update: ",n),"moxie_cc"!==n.key||n.newValue||Nr(e.concierge).catch((function(e){me.log("ERROR clearing history"+e)}))):function(e,t){var n=jr[e];n?n.resolve(t):me.log("SharedStorageBridge: resolveRequest("+e+", "+JSON.stringify(t)+") cannot find outstanding request")}(n.requestId,n);else Vr||me.log('CONCIERGE StoragePlugin request ID mismatch: plug in "'+o.id+'" receved an event for "'+n.requesterId+'"')}}};e.removeListener=function(){window.removeEventListener("message",n,!1)},Fr[e.scriptLocation]=new F((function(t){e.ifrm.onload=function(e){e.target&&e.target.src&&t(e)}})).then((function(){window.addEventListener("message",n,!1)})),e.ifrm.style.display="none",document.body.appendChild(e.ifrm)}return Fr[e.scriptLocation].then((function(){var t="safari"===Mr(window.navigator)[0];return Br(e,{request:"init",shadowInSessionStorage:t}).then((function(t){for(var n in e.parentStorage.removeKeysOtherThan(Object.keys(t.lsValue),!0),e.parentStorage.removeKeysOtherThan(Object.keys(t.ssValue),!1),t.lsValue)e.parentStorage.set(n,t.lsValue[n],!0);for(var i in t.ssValue)e.parentStorage.set(i,t.ssValue[i],!1);e.useSharedStorage=!0})).catch((function(t){throw me.log("SharedStoragePlugin#init: Failed to load from shared storage, removing listener: "+t.message),e.removeListener(),t}))}))},Hr.prototype.name="SharedStoragePlugin",Hr.prototype.has=function(e,t){return this.parentStorage.has(e,t)},Hr.prototype.get=function(e,t){return this.parentStorage.get(e,t)},Hr.prototype.clear=function(){this.parentStorage.clear();return Br(this,{request:"clear"}).then((function(e){return"ack"===e.request}))},Hr.prototype.set=function(e,t,n){if(this.parentStorage.set(e,t,n),!this.skipSaveForKey||!this.skipSaveForKey(e))return Br(this,{request:"store",key:e,value:t,persist:!0===n}).then((function(e){return"ack"===e.request}))},Hr.prototype.del=function(e,t){return this.parentStorage.del(e,t),Br(this,{request:"remove",key:e,persist:!0===t}).then((function(e){return"ack"===e.request}))};var Gr=0;function zr(e){this.id=++Gr,this.concierge=e,this.storagePlugin=this.defaultStoragePlugin=new mr;var t=or("sessionStorage");or("localStorage")&&t?(this.storagePlugin=new kr(this.defaultStoragePlugin),this.storagePluginToLoad=Kn):this.storagePluginToLoad=Xn,this.eventSerialNumber=null,this.saveEventSerialNumber=null,t&&(this.saveEventSerial=this.storeEventSerialNumberSessionStorage,this.eventSerialNumber=this.readEventSerialNumberFromSessionStorage())}function Kr(e,t,n){return F.resolve(e.storagePlugin.del(t,n))}function Xr(e){return"MoxieCache_"+e+"_file"}function Qr(e){if(e&&(delete e.last_updated,delete e.last_submitted,e.session&&e.session.visits)){var t=e.session.visits.length-1;if(t>=0){var n=e.session.visits[t].journey;if(n){var i=n.length-1;i>=0&&(e.session.visits[t].journey[i].end_time=0)}}}}function Yr(e){var t=Xr(Fn);return function(e,t){return F.resolve(e.storagePlugin.get(t,!0)).then((function(e){return e?void 0===e.contents?(me.log("Loaded "+t+" from localStorage, but .contents was undefined"),null):(me.log("Loaded "+t+" from localStorage"),e.contents):null}))}(e,t).then((function(e){if(null!==e)try{return JSON.parse(e)}catch(e){me.log("Error parsing profile: "+e.message)}return null})).then((function(t){if(null!==t)return e.setData(Fn,JSON.stringify(t),!0)})).then((function(){return e}))}function Zr(e){return function(e){return e.storagePlugin.get(Wn,!0)||e.storagePlugin.get(Ln,!0)}(e)?e.autoLoadProperties().then(Yr).then((function(){return e})):function(e){me.log("Creating new identity");var t=e.makeProfileId();return F.all([Jr(e,Ln,t,!0),Jr(e,Wn,t+"|2147483647",!0)]).then((function(){return e.uuid=t,e}))}(e).then(Yr).then((function(){return e}))}zr.prototype.storeEventSerialNumberSessionStorage=function(e){window.sessionStorage.setItem(Gn,JSON.stringify(e))},zr.prototype.readEventSerialNumberFromSessionStorage=function(){var e=window.sessionStorage.getItem(Gn);if(null==e||""===e)return null;var t=null;try{t=JSON.parse(e)}catch(e){return me.log("Could not read serial number from session storage: "+e.message),null}return"number"!=typeof t||Math.floor(t)!==t||t<0||t>zn?null:t},zr.prototype.makeEventSerialNumber=function(){null===this.eventSerialNumber&&(this.eventSerialNumber=Math.floor(Math.random()*(Math.pow(2,32)-1)));var e=this.eventSerialNumber++;return this.saveEventSerial&&this.saveEventSerial(this.eventSerialNumber),this.eventSerialNumber>zn&&(this.eventSerialNumber=0),e},zr.prototype.cleanup=function(){delete this.profileJSON,delete this.uuid},zr.prototype.destroy=function(){this.cleanup(),this.storagePlugin.destroy()},zr.prototype.skipSaveForKey=Ur,zr.prototype.isValidUserProfile=function(e){return void 0!==e.session&&void 0!==e.session.id},zr.prototype.getVisitorProfileId=function(){return this.getDataClone(Ln)},zr.prototype.emitEvent=function(e){var t;return"function"==typeof CustomEvent?t=new CustomEvent(e):(t=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,{}),me.log("CacheManager: emitting profile update event: "+JSON.stringify(t)),this.dispatchEvent(window,t)},zr.prototype.dispatchEvent=function(e,t){return e.dispatchEvent(t)},zr.prototype.resetVisitorProfile=function(){var e=this;return this.concierge.contextMonitor.stop(),Kr(this,Xr(Fn),!0).then((function(){e.visitorProfile=null;var t=e.concierge.contextMonitor.createNewProfile();return e.setData(Fn,JSON.stringify(t))})).then((function(){e.concierge.contextMonitor.start()}))},zr.prototype.setData=ar((function(e,t,n){if(!pi(t))throw new $r("Cannot set "+e+", data must be a string.");if(e===Fn){var i,r=this.getDataClone(Fn);try{i=JSON.parse(t)}catch(t){throw new $r("Cannot set "+e+", data is invalid JSON.")}var a=!1,o=!n&&function(e,t){var n=!1;if(e&&e.session&&e.session.visits&&e.session.visits.length>0){var i=e.session.visits.slice(-1)[0];if(i.journey&&i.journey.length>0){var r=i.journey.slice(-1)[0];new Date-new Date(r.end_time)>60*t*1e3&&(n=!0)}else n=!0}else n=!0;return n}(r,30),s=!1;if(n||null!=r){if(void 0!==i.customData)if(r&&void 0!==r.customData)JSON.stringify(r.customData)!==JSON.stringify(i.customData)&&(s=!0);else s=!0}else a=!0,void 0!==i.customData&&(s=!0);return a&&Ji(this.concierge),o&&Gi(this.concierge),s&&Ki(this.concierge,i.customData),this.storeProfile(t)}if(e===qn)return this[qn]=t,Jr(this,qn,t,!0);if(e===$n)return this.rules_version=t,Jr(this,$n,t,!0);if(e===Un)return this.widgets_version=t,Jr(this,Un,t,!0);throw new $r("Cannot set "+e+", unknown property.")})),zr.prototype.storeProfile=ar((function(e){var t,n=this,i=JSON.parse(e);if(n.isValidUserProfile(i)){n.profileJSON=i;var r=(t=0,{contents:e,timestamp:(new Date).getTime(),version:t});return Jr(n,Xr(Fn),r,!0)}throw new $r("Cannot store profile, it is not valid.")})),zr.prototype.setVolatileData=ar((function(e,t){if(e===Bn||e===Hn)return this[e]=t;throw new $r("Cannot set "+e+".")})),zr.prototype.getVolatileData=function(e){return this[e]},zr.prototype.profileUpdated=function(e){var t=this.getDataClone(Fn),n=di(e);return Qr(n),Qr(t),JSON.stringify(t)!==JSON.stringify(n)},zr.prototype.getData=function(e){var t=this[e];return t?"object"===i(t)?di(this[e]):this[e]:null},zr.prototype.getDataClone=function(e){return this.getData(e)},zr.prototype.getDataObject=function(e){return this[e]?this[e]:null},zr.prototype.removeClientCache=function(e,t){return Kr(this,"conclient_"+e,t)},zr.prototype.setClientCache=function(e,t,n){return Jr(this,"conclient_"+e,t,n)},zr.prototype.getClientCache=function(e,t){return this.storagePlugin.get("conclient_"+e,t)},zr.prototype.removeWidgetCache=function(e,t,n){return Kr(this,e+"-"+t,n)},zr.prototype.setWidgetCache=function(e,t,n,i){return Jr(this,e+"-"+t,n,i)},zr.prototype.getWidgetCache=function(e,t,n){return this.storagePlugin.get(e+"-"+t,n)},zr.prototype.clearWidgetCacheKey=function(e,t){for(var n=[],i=this.storagePlugin;i.parentStorage;)i=i.parentStorage;var r,a=t?"p":"s",o=Object.keys(i.data[a]);for(r=0;r0&&(clearInterval(t),t=0)}}aa.prototype.cleanup=function(){this.stop()},aa.prototype.evalRules=function(){this.monitoredRules.forEach((function(e){this.rulesEngine.evalRule(e)?(this.rulesEngine.queueActions(e),this.unregister(e),e.monitor=!1):this.rulesEngine.rulesSucceeded[e.id]&&this.unregister(e)}),this)},aa.prototype.fetchLocation=function(){return this.concierge.httpGet(this.concierge.serviceUrl.location,{type:"GET"}).then((function(e){var t=e.subdivisions&&e.subdivisions.length?e.subdivisions[0].names.en:"";return{city:e.city?e.city.names.en:"",state:t,country:e.country?e.country.names.en:"",ip_address:"",zip:"",longitude:e.location?e.location.longitude:"",latitude:e.location?e.location.latitude:""}}))},aa.prototype.recordEngagementValue=function(){var e=this.cacheManager.getDataClone(Fn),t=ui(li(e,1),1).current_cart_value;return void 0===e.session.first_engagement_cart_value&&(e.session.dirty=!0,e.session.first_engagement_cart_value=t),void 0===e.session.visits[e.session.visits.length-1].first_engagement_cart_value&&(e.session.visits[e.session.visits.length-1].first_engagement_cart_value=t),this.cacheManager.setData(Fn,JSON.stringify(e))},aa.prototype.parseMappedContext=function(e){if(void 0!==e){"string"==typeof e&&(e=[e]);var t=function(e,t){t.replace(/^\$\[/,"").replace(/\]\$$/,"");var n=on($e(t)),i=n.text()||n.val();return i?i.trim():""};for(var n in e)re(e,n)&&"string"==typeof e[n]&&(e[n]=e[n].replace(/\$\[(.*?)\]\$/g,t));return e}},aa.prototype.initTracking=function(){var e,t=0,n=0,i=this.cacheManager.getDataClone(Fn),r=!1,a=!1,o=Mr(navigator);ra={name:o[0],version:o[1]},ia=Mn(navigator);var s=Number(this.cacheManager.getData(qn)),c=this;if(null==i)(i={id:this.cacheManager.getData(Ln),dirty:!0,tags:null,ip_address:"",all_device_names:[],all_browsers:[{name:ra[0],version:ra[1],language:navigator.language}],all_locations:null,preferences:{never_invite_to_chat:!1,language:navigator.language},session:null,history:{visits:0,last_visit:Date.now(),articles_viewed:0,invited_chat:0,refused_chat:0},last_updated:Date.now(),last_submitted:0}).all_device_names.push(ia),r=!0,a=!0;else{if(Number(ui(li(i,1),1).end_time)2592e3||isNaN(u))&&(i.session=null)}null!==i.session&&0!==i.session.visits.length&&((n=fe(ui(li(i,1),1).end_time))>1800||isNaN(n))&&(a=!0)}if(null===i.session||void 0===i.session){var l={};l.id=hr(),l.visits=[],l.dirty=!0,l.end_cart_value=0,i.session=l,r=!0,a=!0}if(a){var d={};d.id=hr(),d.dirty=!0,d.journey=[],d.browser={name:ra[0],version:ra[1],language:navigator.language},d.device={},d.device.name=Mn(navigator),d.referral={url:document.referrer.substr(0,ta)},d.journey=[],i.session.visits.push(d),i.history.visits+=1,r=!0}var g={};g.id=hr(),g.dirty=!0,g.url=this.concierge.url.substr(0,ta),g.title=this.concierge.pageTitle.substr(0,200),g.start_time=Date.now(),g.end_time=Date.now(),g.referral={url:document.referrer.substr(0,ta)};var f=ui(li(i,1),1),h=f&&f.current_cart_value?f.current_cart_value:0;if(void 0!==this.moxieData.customData&&this.concierge.publicAPI.customData(this.concierge,this.moxieData.customData),void 0!==this.moxieData.currentCartValue){g.current_cart_value=this.moxieData.currentCartValue;var v=this.moxieData.currentCartItems||(f&&f.current_cart_items?f.current_cart_items:[]);tr("cartUpdated",{cartValue:this.moxieData.currentCartValue,cartItems:v}),ji(this.concierge,this.moxieData.currentCartValue,v)}else g.current_cart_value=h;if(void 0!==this.moxieData.currentCartItems){var p;for(g.current_cart_items=[],p=0;p0&&(e.isRunning=!0,e.whenDone=new F((function(t){e.finishedRunning=t})),setTimeout((function(){return e.isRunning?e.next().catch(da):null}))),this.whenDone}};var pa={},ma={};function wa(e,t){if(!t||!t.showOffer)throw new Error("InvalidArgument: handler must have showOffer function");pa[e]=t}function ya(e,t){if(!t||!t.showEngagement)throw new Error("InvalidArgument: handler must have showEngagement function");ma[e]=t}function ba(e){var t=void 0!==pa[e];return t||me.warn("[CustomActions] unable to find custom offer type, ".concat(e,". It must be registered with concierge before use.")),t}function Sa(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Ca(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return mn(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ca(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function Ca(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n0){var P=B(Ia(p,g,a),2);return f=P[0],h=P[1],d=ci(f,oi(r,v),h),Ea(d,o)}return!0}return!1;case 9:g=t.numberOfPagesVisited();var j=B(Ia(p,g,a),2);return f=j[0],h=j[1],d=ci(f,oi(r,v),h),Ea(d,o);case 10:g=t.geographicLocationItem("city");var F=B(Ia(p,g,a),2);return f=F[0],h=F[1],d=ci(f,oi(r,v),h),Ea(d,o);case 11:g=t.geographicLocationItem("state");var V=B(Ia(p,g,a),2);return f=V[0],h=V[1],d=ci(f,oi(r,v),h),Ea(d,o);case 12:g=t.geographicLocationItem("country");var q=B(Ia(p,g,a),2);return f=q[0],h=q[1],d=ci(f,oi(r,v),h),Ea(d,o);case 13:g=t.numberOfTimesPageViewed();var H=B(Ia(p,g,a),2);return f=H[0],h=H[1],d=ci(f,oi(r,v),h),Ea(d,o);case 14:g=t.referralURL();var $=B(Ia(p,g,a),2);return f=$[0],h=$[1],d=ci(f,oi(r,v),h),Ea(d,o);case 15:g=t.lastPageVisitedItem("url");var U=B(Ia(p,g,a),2);return f=U[0],h=U[1],d=ci(f,oi(r,v),h),Ea(d,o);case 16:g=t.lastPageVisitedItem("title");var J=B(Ia(p,g,a),2);return f=J[0],h=J[1],d=ci(f,oi(r,v),h),Ea(d,o);case 17:case 18:if((g=18===v?t.previouslyVisitedItems("title"):t.previouslyVisitedItems("url"))&&g.length){d=!1;for(var G=0;G=1,o);case 1001:if(g=t.elementValue(m),si(r=oi(r,v,a))&&isNaN(ln(g.value))&&(g.value="",g.text&&(isNaN(ln(g.text))||(g.value=g.text,delete g.text))),""!==g.value){var X=B(Ia(p,g.value,a),2);if(!(d=ci(f=X[0],r,h=X[1]))&&g.text){var Q=B(Ia(p,g.text,a),2);d=ci(f=Q[0],r,h=Q[1])}return Ea(d,o)}return!1;case 1002:if(null==(g=t.customValue(m))||""===g)return!1;var Y=B(Ia(p,g,a),2);return f=Y[0],h=Y[1],void 0!==(d=ci(f,oi(r,v,a),h))&&Ea(d,o);default:return me.error("Unknown Scope/Criteria input value:",v),!1}}catch(e){var Z=n[0];return me.error('Moxie Concierge Client: Scope/Criteria Eval Error ("'+Z+'" input:'+v+"): "+e.message),!1}},Oa=function(e,t){var n=t[3];return null===n||_a(e,t,n)},xa=function(e){var t=e[6];return{name:e[0],id:e[1],source:"offer",monitor:e[2],action:{success:e[5]},criteria:e[6],ruleArray:e,hasEvent:!!t}},Ta=function(e,t,n){var i=this,r=function(t){i.evalRule(e,!0)&&i.queueActions(e)};te(n,"click")>=0&&this.eventListenerUnsubs.push(function(e,t,n){var i=t.selector,r=$e(i),a=fn(e,n,"none",[]);if(r.length>0)return Z(r,At,hn,a),Z(r,At,vn,a),sn((function(){Z(r,Dt,hn,a),Z(r,Dt,vn,a)}));var o=Lt(Mt,hn,jt(i),a,!0),s=Lt(Mt,vn,jt(i),a,!0);return sn((function(){Wt(Mt,hn,o),Wt(Mt,vn,s)}))}(e,{selector:t},r)),te(n,"change")>=0&&this.eventListenerUnsubs.push(function(e,t,n,i,r){var a=t.selector,o=$e(a),s=fn(e,n,i,r);if(o.length>0)return Z(o,At,pn,s),sn((function(){Z(o,Dt,pn,s)}));var c=Lt(Mt,pn,jt(a),s,!0);return sn((function(){Wt(Mt,pn,c)}))}(e,{selector:t},r,"none",[]))};ka.prototype.removeAllEventListeners=function(){var e,t=Sa(this.eventListenerUnsubs);try{for(t.s();!(e=t.n()).done;){(0,e.value)()}}catch(e){t.e(e)}finally{t.f()}},ka.prototype.init=function(e){this.siteRules=e,this.actionLibrary=new ga(this.concierge),this.criteriaLibrary=new ha(this.concierge),this.bodyEventListeners={},this.ruleObjectsByIndex=[],this.eventListenerUnsubs=[];for(var t=0;t=0?this.siteRules.settings.queue_wait_time:5},ka.prototype.minTimeBetween=function(){return this.siteRules&&this.siteRules.settings&&this.siteRules.settings.min_time_between>=0?this.siteRules.settings.min_time_between:60},ka.prototype.hideWhenServiceLineClosed=function(){return this.siteRules&&this.siteRules.settings&&this.siteRules.settings.hide_on_demand_chat_when_service_line_is_closed},ka.prototype.checkQueueWaitTimeForReactive=function(){return this.siteRules&&this.siteRules.settings&&this.siteRules.settings.use_min_time_between_for_on_demand_chat},ka.prototype.checkQueueWaitTimeForProactive=function(){return this.siteRules&&this.siteRules.settings&&this.siteRules.settings.use_min_time_between_for_proactive_chat},ka.prototype.run=function(){var e,t,n;for(e=[],t=0;t0&&(t[0].execute(),!0)}(e))return me.log("wmStateCanMakeOffer false because DFO chat is active"),!1;var n=Pa(e,t);if(n){var i=fa(Ra(e,n),"widget");if(i&&!i.hasFinished&&0!==i.state)return!1}return!0}function Fa(e){return!!e.offer}function Va(e){return!!e.open}function qa(e){return!!e.notification}function Ba(e,t){return yo(t)?function(e,t){if(null===t.preferredSpotName())return!0;var n=Ra(e,t.spot);if(n){if(!n.widget)return!0;if(ao(e,n.widget))return!1;if(n.widget.hasFinished)return!0;if(n.widget.priorityt.priority||0===t.state)}(e,r.widget,t))&&$a(e,t))}function Ga(e,t){var n=t.parameters;n.rule=n.rule||{},n.proactive=!0;var i=t.label();if(function(e){var t=1e3*e.rulesEngine.minTimeBetween();if(t<=0)return!1;return Date.now()=0:e.active.filter((function(e){return e.name===ni})).length>0}function oo(e,t){te(e.alive,t)<0&&e.alive.push(t)}function so(e,t){var n=te(e.alive,t);n>=0&&e.alive.splice(n,1)}function co(e,t){var n=e.wm.concierge.cacheManager.getClientCache(ei,!0);return n&&n.left&&n.top&&n.initialElemData&&n.initialConfigData&&t.name!=ni&&(e.wm.isDragConfigDataEqualToCurrent(n.initialConfigData)?(e.wm.widgetAreaDragData.x=n.left,e.wm.widgetAreaDragData.y=n.top,e.wm.widgetAreaDragData.initialElemData=n.initialElemData,e.wm.widgetAreaDragData.draggedByUser=!0):e.wm.concierge.cacheManager.removeClientCache(ei,!0)),ao(e,t)?F.resolve(null):(t.active=!0,e.active.push(t),tr("widgetActivated",{widgetName:t.name}),lo(e))}function uo(e,t){if(t.name!=ni){var n=te(e.active,t);n>=0&&(t.active=!1,e.active.splice(n,1),lo(e))}else t.active=!1,e.active=e.active.filter((function(e){return e.name!=ni})),lo(e);0===e.active.length&&e.wm.concierge.cacheManager.removeClientCache(ei,!0)}function lo(e){var t=e.active.map((function(e){return{widgetName:e.name,loadParams:e.parameters}}));return e.wm.concierge.cacheManager.setClientCache("activeWidgets",t)}function go(e){return 9===e}function fo(e){return 13===e}function ho(e){return 32===e}function vo(e){return 38===e}function po(e){return 40===e}var mo=["onafterprint","onbeforeprint","onbeforeunload","onerror","onhashchange","onload","onmessage","onoffline","ononline","onpagehide","onpageshow","onpopstate","onresize","onstorage","onunload","onblur","onchange","oncontextmenu","onfocus","oninput","oninvalid","onreset","onsearch","onselect","onsubmit","onkeydown","onkeypress","onkeyup","onclick","ondblclick","onmousedown","onmousemove","onmouseout","onmouseover","onmouseup","onmousewheel","onwheel","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","onscroll","oncopy","oncut","onpaste","onabort","oncanplay","oncanplaythrough","oncuechange","ondurationchange","onemptied","onended","onerror","onloadeddata","onloadedmetadata","onloadstart","onpause","onplay","onplaying","onprogress","onratechange","onseeked","onseeking","onstalled","onsuspend","ontimeupdate","onvolumechange","onwaiting","ontoggle"];function wo(e){return e===Qn||e===Yn}function yo(e){return wo(fa(e,"parameters","rule","source"))}var bo={status:!1},So="free-floating";function Co(e){return"kbot"===e}function ko(e){return function(e){return"chat"===e}(e)||Co(e)}function Eo(e){return function(e){return"kbot"===e||e==ni}(e)?"chat":e}function Io(e){return!!e.engagementWidgets.globalSettings.singleChannelMode}function _o(e,t){var n=Ra(e,t.spot);return!n||(!n.widget||t!==n.widget&&(!ao(e,n.widget)&&(!!t.parameters&&!!function(e,t){if(!e||!t)return!0;var n=e.parameters,i=t.parameters;if(!n||!i)return!1;if(e.name!==t.name)return!0;switch(e.name){case"chat":if(parseInt(n.portalId,10)!==parseInt(i.portalId,10))return!0;break;case"kb":if(parseInt(n.portalId,10)!==parseInt(i.portalId,10))return!0;if(""+n.searchText!=""+i.searchText)return!0;if(""+n.articleId!=""+i.articleId)return!0;break;case"cxone-expert":if(parseInt(n.siteId,10)!==parseInt(i.siteId,10))return!0;if(""+n.searchText!=""+i.searchText)return!0;if(""+n.articleUrl!=""+i.articleUrl)return!0;if(""+n.touchpointId!=""+i.touchpointId)return!0;break;case"email":if(parseInt(n.mailboxId,10)!==parseInt(i.mailboxId,10))return!0}return!1}(n.widget,t))))}function Oo(e){return on('#concierge-widgets ul li[data-spot="'+e+'"]')}function xo(e){if(void 0!==e){var t,n;try{t=e.width.animVal.value,n=e.height.animVal.value}catch(e){return!1}we(e,"viewBox")||ye(e,"viewBox","0 0 "+t+" "+n),ye(e,"height",25),ye(e,"width",25)}}function To(e,t){var n=F.resolve(),i=e.wmState.open;if(!i)return n;var r=on("#concierge-widget-area");r.removeClass("con-open"),e.widgetsType.closeWidgets&&e.widgetsType.closeWidgets();var a=i.name;return e.$concierge.find("#concierge-widgets li[data-widget="+a+"] .con-icon").attr("aria-expanded","false"),e.device===An&&(r.hasClass("con-animating")&&(n=n.then((function(){return r.promise()}))),n=n.then((function(){e.makePositionFixed(),e.forceBlur()}))),e.$concierge.removeClass("con-open-widget"),e.openWidget=!1,e.wmState.open=null,n.then((function(){if(e.widgetsType.focusWidgetButton(a),t)return tr("widgetClosed",{widgetName:a})})).catch((function(e){me.log("Error Closing Widget:"+e)}))}function Ao(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";try{var n=new DOMParser;e=n.parseFromString(t,"text/html")}catch(e){return me.error("DomParser failed to parse:",t,"with error:",e),""}return mn(e.getElementsByTagName("*")).forEach((function(e){"SCRIPT"===e.nodeName?e.parentElement.removeChild(e):mo.forEach((function(t){e.removeAttribute(t)}))})),e.documentElement.outerHTML}function Do(e){var t="other";return 2===e?t="widgetMessage":1===e&&(t="proactiveOffer"),t}function No(e,t){return function(n){return!e._disabled&&n&&n.status?t(n):n&&!n.status?n:bo}}function Mo(e,t){var n=e.wmState,i=on("#concierge-widgets ul"),r=i.children("li");if(!(r.length<=1)){var a=t?1:-1;r.sort((function(e,t){var i=e.getAttribute("data-spot"),r=t.getAttribute("data-spot"),o=Ra(n,i).widget.sortKey,s=Ra(n,r).widget.sortKey;return o>s?1*a:on&&!i&&!r)throw new Error("queue wait time is too long");return!0}function Wo(e,t){var n=e.getDataClone(Fn),i=n.session.visits.length-1,r=n.session.visits[i].journey.length-1;n.session.visits[i].journey[r].engagements||(n.session.visits[i].journey[r].engagements=[]),n.session.visits[i].journey[r].engagements.push(t),e.setData(Fn,JSON.stringify(n))}function Ro(e,t,n){for(var i=e.getData(Fn),r=i.session.visits[i.session.visits.length-1].journey,a=r.length-1,o=JSON.stringify(n),s=a;s>=0;s--){var c=r[s].engagements;if(c)for(var u=c.length-1;u>=0;u--){var l=c[u];if(l.id===t){if(JSON.stringify(l)===o)return F.resolve();if(n.dirty=!0,s===a)c[u]=n;else{c.splice(u,1),0===c.length&&delete r[s].engagements;var d=r[a];d.engagements?d.engagements.push(n):d.engagements=[n]}return e.setData(Fn,JSON.stringify(i))}}}return F.resolve()}function Po(e,t){for(var n=e.getDataObject(Fn),i=n.session.visits.length-1,r=0;rd||(g={timeout:d+5e3,value:l.checkAvailability(o).then(i,r)},n[c]=g),g.value}))},this.customData=function(t){return e.ready.then((function(){var n=e.cacheManager,i=n.getDataClone(Fn);if(void 0===i)throw new Error("Could not find visitor profile.");if(void 0===t)return i.customData;if(!JSON.stringify(t))throw new Error("Could not stringify customData");return i.customData=t,n.setData(Fn,JSON.stringify(i)).then((function(){return t}))}))},this.channelsData=function(t){return e.ready.then((function(){var n=e.cacheManager;return void 0===t?n.getVolatileData(Bn):n.setVolatileData(Bn,t)}))},this.channelsFormData=function(t){return e.ready.then((function(){var n=e.cacheManager;return void 0===t?n.getVolatileData(Hn):n.setVolatileData(Hn,t)}))},this.onQuestionnaireLoaded=function(t){e.onQuestionnaireLoadedCallbacks.add(t)},this.onQuestionnaireSubmit=function(t){e.onQuestionnaireSubmitCallbacks.add(t)},this.engagementHandlers=ma,this.registerEngagementHandler=ya,this.offerHandlers=pa,this.registerOfferHandler=wa}function Vo(){function e(e){return e.status}function t(e){return me.log("checkAvailability error thrown: "+e.message),"false"}this.broadcast=Vo.broadcast,this.transactionComplete=function(e,t){var n,i,r;return n=e.cacheManager,(r=n.getDataClone(Fn)).last_updated=Date.now(),r.session.transaction_completed=!0,void 0!==t&&(r=nr(r,t,e)),i=ui(li(r,1),1),e.contextMonitor.stop(),n.setData(Fn,JSON.stringify(r),!0).then((function(){return Vo.broadcast("transactionCompleted",{transactionTotal:r.session.end_cart_value,cart:{value:i.current_cart_value,items:i.current_cart_items}}),Pi(e,r.session.end_cart_value),er(e,"transactionComplete"),e.contextMonitor.initTracking().then((function(){e.contextMonitor.start()}))}))},this.updateSession=function(e,t){var n,i;t=t||{},i=nr((n=e.cacheManager).getDataClone(Fn),t,e),n.setData(Fn,JSON.stringify(i))},this.startEngagement=function(e,t){var n,i,r={};if(i=e.widgetManager,t&&"string"==typeof t.widget){if(ir(t.widget))throw new Error("The engagement type is not allowed: "+t.widget);if(i.engagementWidgets.widgets[t.widget]){if(i.isValidEngagementConfig(t)){for(n in re(t,"enableChatDeflection")&&!0===t.enableChatDeflection&&(t.widget="kbot"),t)re(t,n)&&(r[n]=t[n]);var a,o={name:t.ruleName,source:Qn,id:-2,action:"success"};return r.rule=o,a=i.addWidget(t,o).then((function(e){!1!==i.openWidget&&i.openWidget!==t.widget&&i.hideWidget(!0),eo(i.wmState),i.showWidget(e.ref),i.showConcierge(),i.widgetsType.openConcierge()})),er(e,"startEngagement"),a}me.log("GoMoxie.concierge.startEngagement: invalid widget configuration")}else me.log('GoMoxie.concierge.startEngagement: invalid value for configuration parameter "widget"')}else me.log("GoMoxie.concierge.startEngagement: missing required configuration parameter")},this.closeNotification=function(e,t){var n=e.widgetManager;return er(e,"closeNotification"),t?eo(n.wmState):to(n.wmState)},this.startTrackingEngagement=function(e,t){new jo(e,t).startEngagement(),er(e,"startTrackingEngagement")},this.updatePage=function(e,t,n){var i;return e.ready.catch((function(){return!1})).then((function(){return e.eventService.stub||(i=e.eventService),e.rulesEngine.removeAllEventListeners(),e.contextMonitor.stop(),e.cacheManager.cleanup(),e.widgetManager.destroy(),null})).then((function(){return er(e,"updatePage"),e.init(t,n,{eventService:i})}))},this.checkAvailability=function(n,i,r,a){var o,s,c,u,l,d,g,f,h,v,p;if(o={parameters:r},s=n.cacheManager,c=n.widgetManager,f=r.portalId,u="availability",l="availability-timestamp","chat"===i){if(void 0===f){if(void 0===(g=c.engagementWidgets.widgets.chat.portalId))return void me.log("No Moxie portal/mailbox ID specified for engagement.");f=g,o.parameters.portalId=f}o.ruleSettings=n.rulesEngine.getSiteSettings(),u+="|"+f+"|"+c.device,l+="|"+f+"|"+c.device}return d=c.engagementWidgets.widgets[i],v=1e5,(h=s.getWidgetCache(i,l,!1))&&(v=(Date.now()-h)/1e3),p=h&&v<=5&&s.getWidgetCache(i,u,!1)?F.resolve(s.getWidgetCache(u)):d.checkAvailability(o).then(e,t).then((function(e){return F.all([s.setWidgetCache(i,u,e,!1),s.setWidgetCache(i,l,Date.now(),!1)]).then((function(){return e}))})),er(n,"checkAvailability"),p.then((function(e){return a(e),e}))},this.customData=function(e,t){var n,i;return i=(n=e.cacheManager).getDataClone(Fn),void 0===t?void 0!==i?i.customData:void 0:JSON.stringify(t)?(i.customData=t,n.setData(Fn,JSON.stringify(i)),!0):(er(e,"customData"),!1)},this.channelsData=function(e,t){var n=e.cacheManager;if(void 0===t)return n.getVolatileData(Bn);try{n.setVolatileData(Bn,t)}catch(e){return me.log("channelsData: "+e),!1}return er(e,"channelsData"),!0},this.channelsFormData=function(e,t){var n=e.cacheManager;if(void 0===t)return n.getVolatileData(Hn);try{n.setVolatileData(Hn,t)}catch(e){return me.log("Error: "+e),!1}return er(e,"channelsFormData"),!0},this.onQuestionnaireLoaded=function(e,t){e.onQuestionnaireLoadedCallbacks.add(t)},this.onQuestionnaireSubmit=function(e,t){e.onQuestionnaireSubmitCallbacks.add(t)},this.registerMethods=function(e,t){void 0!==t&&void 0!==t.concierge&&(t.concierge.updateSession=this.updateSession.bind(void 0,e),t.concierge.transactionComplete=this.transactionComplete.bind(void 0,e),t.concierge.startEngagement=this.startEngagement.bind(void 0,e),t.concierge.checkAvailability=this.checkAvailability.bind(void 0,e),t.concierge.customData=this.customData.bind(void 0,e),t.concierge.closeNotification=this.closeNotification.bind(void 0,e),t.concierge.channelsData=this.channelsData.bind(void 0,e),t.concierge.channelsFormData=this.channelsFormData.bind(void 0,e),t.concierge.startTrackingEngagement=this.startTrackingEngagement.bind(void 0,e),t.concierge.onQuestionnaireLoaded=this.onQuestionnaireLoaded.bind(void 0,e),t.concierge.onQuestionnaireSubmit=this.onQuestionnaireSubmit.bind(void 0,e),t.concierge.updatePage=this.updatePage.bind(void 0,e),e.isTestMode&&(t.concierge.root=e))}}function qo(e){return e.signature="moxie_concierge",e}jo.prototype.startEngagement=function(){if(!this.isValid)return me.log("GoMoxie.concierge.startTrackingEngagement: unable to start engagement that had an invalid configuration"),!1;var e=function(e){var t={chat:null,decision_type:"",email:null,id:hr(),kb:null,name:e.engagementType,proactive:!1,rule:{name:e.ruleName,source:Qn,id:-2,ruleAction:"success"},time:Date.now(),type:2};for(var n in e)"engagementType"!==n&&"ruleName"!==n&&re(e,n)&&(t[n]=e[n]);return t}(this.config);return Wo(this.concierge.cacheManager,e),!0},jo.prototype.validateParams=function(e){var t,n;for(t in n=!0,"object"===i(e)&&e.engagementType&&e.ruleName||(me.log("GoMoxie.concierge.TrackingEngagement.validateParams: missing required configuration parameter"),n=!1),e)re(e,t)&&"string"!=typeof e[t]&&(me.log("GoMoxie.concierge.TrackingEngagement.validateParams: invalid engagement parameter: "+t),n=!1);return n},Fo.broadcast=tr,Vo.broadcast=tr;var Bo=[" ","\n","\t"];function Ho(){this.outputRaw=[],this.outputSub=[],this.currentSub=null,this.state=1,this.compiled=[],this.actions=[]}function $o(e){var t=new Ho;return t.compile(e),function(e){return t.evaluate(e)}}Ho.prototype.compile=function(e){var t,n;for(t=0;t!==e.length;t++)switch(n=e[t],this.state){case 1:this.handleStateInput(n);break;case 2:this.handleStateOpen(n);break;case 4:this.handleStateSubOperator(n);break;case 3:this.handleStateSubInit(n);break;case 5:this.handleStateSub(n);break;case 6:this.handleStateSubFinal(n);break;case 7:this.handleStateClose(n)}var i=[],r=null;for(t=0;t!==this.outputRaw.length;t++)null===(n=this.outputRaw[t])?null!==r&&(i.push([r,t]),r=null):null===r&&(r=t);null!==r&&i.push([r,this.outputRaw.length]),this.outputSub.reduce((function(e,t){return null!==t&&e.push(t),e}),[]);var a=0;for(t=0;t!==i.length;t++){r=i[t][0];for(var o=i[t][1];a!==r;a++)this.actions.push(2),this.compiled.push(this.outputSub[a]);this.compiled.push(this.outputRaw.slice(r,o).join("")),a=o,this.actions.push(1)}this.outputRaw=null,this.outputSub=null},Ho.prototype.evaluate=function(e){for(var t,n=[],i=0;i!==this.actions.length;i++){switch(this.actions[i]){case 1:n.push(this.compiled[i]);break;case 2:null!=(t=e[this.compiled[i]])&&n.push(t)}}return n.join("")},Ho.prototype.handleStateInput=function(e){"<"===e?this.state=2:(this.outputRaw.push(e),this.outputSub.push(null))},Ho.prototype.handleStateOpen=function(e){"%"===e?this.state=4:(this.outputRaw.push("<"),this.outputRaw.push(e),this.outputSub.push(null),this.outputSub.push(null),this.state=1)},Ho.prototype.handleStateSubOperator=function(e){if("="!==e)throw new Error("Operator for the template must be '=', not '"+e+"'");this.state=3},Ho.prototype.handleStateSubInit=function(e){-1===Bo.indexOf(e)&&(this.currentSub=[e],this.state=5)},Ho.prototype.handleStateSub=function(e){if(-1===Bo.indexOf(e))return"%"===e?(this.finishSub(),void(this.state=7)):void this.currentSub.push(e);this.finishSub(),this.state=6},Ho.prototype.finishSub=function(){this.outputSub.push(this.currentSub.join("")),this.outputRaw.push(null),this.currentSub=null},Ho.prototype.handleStateSubFinal=function(e){if(-1===Bo.indexOf(e)){if("%"!==e)throw new Error("Stray character '"+e+"' after substitution");this.state=7}},Ho.prototype.handleStateClose=function(e){if(">"!==e)throw new Error("Invalid sequence '"+e+"' after closing percent sign");this.state=1};var Uo=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||function(e){return setTimeout(e,1e3/60)},Jo=window.cancelAnimationFrame||window.mozCancelAnimationFrame||function(e){clearTimeout(e)},Go="_animations",zo=new(function(){function t(){e(this,t),this.duration=300,this.aniCount=0,this.frameCount=0,this.timeCount=0,this.animations={},this.frames={},this.timeouts={}}return n(t,[{key:"count",value:function(){return this.aniCount+this.frameCount+this.timeCount}},{key:"animationIds",value:function(){return Object.keys(this.animations)}},{key:"frameIds",value:function(){return Object.keys(this.frames)}},{key:"timeoutIds",value:function(){return Object.keys(this.timeouts)}}]),t}());function Ko(e){!function(e,t){var n=Ut(e,Go);void 0===n?$t(e,Go,[t]):n.push(t)}(e.element,e.id),zo.animations[e.id]=e,zo.aniCount+=1}function Xo(e){zo.frames[e]&&(zo.frameCount-=1,delete zo.frames[e])}function Qo(e){zo.timeouts[e]&&(zo.timeCount-=1,delete zo.timeouts[e])}function Yo(e){var t;!function(e,t){var n=Ut(e,Go);if(void 0!==n){var i=n.indexOf(t);0===i?Jt(e,Go):i>=0&&n.splice(i,1)}}(e.element,e.id),function(e){zo.animations[e.id]&&(delete zo.animations[e.id],zo.aniCount-=1)}(e),e.curAniFrame&&((t=e.curAniFrame)&&(Xo(t),Jo(t)),e.curAniFrame=!1),e.doneTimeout&&(Qo(e.doneTimeout),window.clearTimeout(e.doneTimeout),e.doneTimeout=!1)}var Zo=0,es=function(){function t(n,i,r,a){e(this,t),Zo+=1,this.id=Zo,this.element=n,this.duration=i,this.doneHandler=r,this.label=a,this.startTime=null,this.doneTimeout=!1,this.curAniFrame=!1,this.animator=null,this.doneFunction=null}return n(t,[{key:"finish",value:function(){if(Yo(this),this.animator){var e=Date.now();this.startTime=e-this.duration,this.animator(e)}}},{key:"done",value:function(){if(Yo(this),this.doneHandler)try{this.doneHandler.call(this.element)}catch(e){me.error("ERROR in animation done handler",e)}}},{key:"cancel",value:function(){Yo(this)}}]),t}();function ts(e,t){var n=Ut(e,Go);if(n&&n.length){n=mn(n);for(var i=0;i=c?1:n/c,r={};for(var o in t){var s=Number(bt(o,t[o]))-a[o];r[o]=yt(o,a[o]+s*i)}Xt(this.element,r),n>=this.duration?this.done():this.curAniFrame=is(this.animator,this.label)}.bind(l),c>0?(l.curAniFrame=is(l.animator,l.label),l.doneTimeout=window.setTimeout(function(){Qo(l.doneTimeout),l.doneTimeout=!1,Yo(l);var e=Date.now();l.startTime=e-c,l.animator(e)}.bind(l),c),function(e,t){zo.timeCount+=1,zo.timeouts[e]=t||"unknown"}(l.doneTimeout,l.label),Ko(l)):l.animator(Date.now())}function is(e,t){var n=Uo((function(t){Xo(n),e(t)}));return function(e,t){zo.frameCount+=1,zo.frames[e]=t||"unknown"}(n,t),n}var rs=function(){function t(){e(this,t)}return n(t,[{key:"offerShown",value:function(e,t){e.concierge.currentOfferCreatedAt=Date.now(),Fi(e.concierge,t.name,t.parameters.rule)}}]),t}();function as(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=U(e);if(t){var r=U(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return X(this,n)}}var os=function(t){z(r,t);var i=as(r);function r(){var t;return e(this,r),(t=i.call(this)).type="default",t}return n(r,[{key:"showNotification",value:function(e,t){e.showNotification(t),this.offerShown(e,t)}}]),r}(rs);function ss(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=U(e);if(t){var r=U(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return X(this,n)}}var cs=function(t){z(r,t);var i=ss(r);function r(t){var n;return e(this,r),(n=i.call(this)).type="custom",n.guideOffer={offerType:t.customOfferName,parameters:va(t,"customOffer:")},n}return n(r,[{key:"showNotification",value:function(e,t){var n,i,r=this,a=t.parameters.rule,o=this.guideOffer.parameters,s=t.parameters.rule.action;this.offerCallbacks={offerShown:function(){r.offerShown(e,t),me.debug("[CustomActions] Concierge Code: concierge internal logic fired for offer shown.",{rule:a,parameters:o,actionType:s})},offerNotShown:function(){me.debug("[CustomActions] Concierge Code: concierge internal logic fired for offer NOT shown.",{rule:a,parameters:o,actionType:s})},offerAccepted:function(){me.debug("[CustomActions] Concierge Code: concierge internal logic fired for offer accepted.",{rule:a,parameters:o,actionType:s}),Ka(e.wmState)},offerDeclined:function(){me.debug("[CustomActions] Concierge Code: concierge internal logic fired for offer declined.",{rule:a,parameters:o,actionType:s}),Xa(e.wmState)}},e.concierge.currentOfferCreatedAt=Date.now(),n=this.guideOffer,i=this.offerCallbacks,ba(n.offerType)&&pa[n.offerType].showOffer(n,i)}}]),r}(rs);function us(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=U(e);if(t){var r=U(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return X(this,n)}}var ls=function(t){z(r,t);var i=us(r);function r(){var t;return e(this,r),(t=i.call(this)).type="none",t}return n(r,[{key:"showNotification",value:function(e,t){Ka(e.wmState)}}]),r}(rs),ds="tab",gs="tab-widgets",fs="tab-widgets-content";var hs=function(e){e.$notifAnimate&&(Z(e.$notifAnimate,ts,!0,!0),delete e.$notifAnimate),e.$areaAnimate&&(Z(e.$areaAnimate,ts,!0,!0),delete e.$areaAnimate)},vs=function(e){return 0===e.tabStyle.cascade},ps=function(e,t){var n=t.index();if(n<0)return 0;vs(e)||(n=t.parent().children("li").length-(n+1));return n+1};function ms(e,t,n){e&&(n.classList.remove("con-closed"),n.classList.add("con-open")),t&&(n.classList.remove("con-open"),n.classList.add("con-closed"))}function ws(e,t,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"animate__";return new F((function(a){var o="".concat(r).concat(t),s=document.querySelector(e),c=document.getElementById("concierge");s.classList.add("".concat(r,"animated"),o),s.addEventListener("animationend",(function(e){e.stopPropagation(),s.classList.remove("".concat(r,"animated"),o),ms(n,i,c),a("Animation ended")}),{once:!0})}))}var ys=function(e){var t=e.widgetsType.getNotification();if(vs(e)?ws("#concierge-widgets-ul","fadeInDown",!0,!1):ws("#concierge-widgets-ul","fadeInUp",!0,!1),qa(e.wmState)){var n={},i=Oo(e.wmState.notification.spot),r=65*ps(e,i);1===i.length&&(n[vs(e)?"top":"bottom"]=r),ee(t,ns,n,{label:"desktopNotificationSlideOpen",done:function(){delete self.$notifAnimate}}),self.$notifAnimate=t}},bs=function(e){var t=e.widgetsType.getNotification();if(vs(e)?ws("#concierge-widgets-ul","fadeOutUp",!1,!0):ws("#concierge-widgets-ul","fadeOutDown",!1,!0),e.widgetsType.notificationDisplayed){hs(self);var n={};n[vs(e)?"top":"bottom"]=0,ee(t,ns,n,{label:"desktopNotificationSlideClosed"})}},Ss=function(e,t,n){var i=t.find(".con-notch"),r={},a=ps(e,n);return r[vs(e)?"top":"bottom"]=function(e,t){return Io(e)?13:65*t+13}(e,a),e.state===fs?(ee(i,ns,r,{label:"adjustNotch"}),!1):(i.css(r),!0)},Cs=function(e){var t=e.$concierge;e.engagementWidgets.globalSettings.hideMoxieBranding&&t.addClass("hide-moxie")},ks=function(e,t){var n=e.$concierge.find("#concierge-widget-area");if(Ss(e,n,t)){n.hasClass("con-animating")?n.stop():n.css({opacity:0,right:50,display:"inline-block"}),Cs(e);var r={opacity:1};void 0!==e.widgetAreaDragData.x&&void 0!==e.widgetAreaDragData.y?(n.addClass(So),r.left=e.widgetAreaDragData.x,r.top=e.widgetAreaDragData.y):r.right=75,n.addClass("con-animating").addClass("con-open"),ee(n,ns,r,{label:"desktopOpenArea",done:function(t,r){delete e.widgetsType.$areaAnimate,function(e,t){for(var n in t)Qt(e,t[n])}(n[0],["display","opacity","right"]),n.removeClass("con-animating"),r||"object"!==i(window.visualViewport)||e.widgetsType.applyKeyboardOffset(),e.widgetAreaDragData&&e.widgetAreaDragData.draggedByUser&&e.widgetAreaDragData.resizedWhileMinimized&&e.dragFixAfterResize()}})}e.state=fs,e.widgetsType.$areaAnimate=n},Es=function(e,t){"object"===i(window.visualViewport)&&e.widgetsType.resetKeyboardOffset();var n=e.$concierge.find("#concierge-widget-area");e.state===fs&&(n.hasClass("con-animating")?n.stop():n.css({opacity:1,right:75,display:"block"}),t.css({display:"block"}),n.addClass("con-animating").removeClass("con-open"),ee(n,ns,{opacity:0,right:50,display:"none"},{label:"desktopCloseArea",done:function(){delete e.widgetsType.$areaAnimate,n.removeAttr("style"),n.removeClass("con-animating"),t.removeAttr("style")}}),e.state=gs,e.widgetsType.$areaAnimate=n)},Is=function(e){e.$concierge.find("#concierge-widgets");var t=e.$concierge.find("#concierge-tab");e.state!==ds||e.$concierge.hasClass("with-widgets")?e.state===fs?(e.$concierge.find("#concierge-widget-area").removeClass("con-open"),t.removeClass("con-pressed"),t.attr("aria-expanded","false"),e.$concierge.removeClass("with-widgets"),Os(e),e.state=ds,bs(e),e.$concierge.addClass("con-closed")):(t.removeClass("con-pressed"),t.attr("aria-expanded","false"),e.$concierge.removeClass("with-widgets"),e.state=ds,bs(e),e.$concierge.addClass("con-closed")):(e.$concierge.addClass("with-widgets").removeClass("con-closed"),t.addClass("con-pressed"),t.attr("aria-expanded","true"),e.state=gs,ys(e))};function _s(e){e.$concierge.find("#concierge-widgets");var t=e.$concierge.find("#concierge-tab");e.$concierge.addClass("with-widgets").removeClass("con-closed"),t.addClass("con-pressed"),t.attr("aria-expanded","true"),e.state=gs,document.getElementById("concierge").classList.contains("with-widgets")||ys(e)}var Os=function(e){var t=e.$concierge.find("#concierge-widgets li.con-active");t.removeClass("con-active").removeClass("con-pressed"),t.find(".con-notch").remove(),t.find(".con-icon").attr("aria-expanded","false");var n=e.$concierge.find("#concierge-widget-area .concierge-widget.con-active"),i=F.resolve(null);return e.openWidget&&(i=i.then((function(){return e.hideWidget(!1)}))),i.then((function(){return Es(e,n)}))},xs=function(e,t){var n=t.parameters,i=t.engagementId,r=Oo(t.spot);if(r.hasClass("con-active"))return e.openWidget&&e.openWidget!==t.name?e.hideWidget(!1):F.resolve(null);r.addClass("con-active").addClass("con-pressed"),r.find(".con-icon").attr("aria-expanded","true");var a=n.rule.source;return i&&"offer"!==a&&"notification"!==a&&"button"!==a&&(n.rule.source="internal"),t.execute(e)},Ts=function(){var e=on(this);e.addClass("con-pressed"),e.data("pressing",1),"concierge-tab"===e.attr("id")&&e.attr("aria-expanded","true"),e.find(".con-icon")&&e.find(".con-icon").attr("aria-expanded","true")},As=function(){var e=on(this);1===e.data("pressing")&&(e.data("pressing",0),e.removeClass("con-pressed"),e.find(".con-icon")&&e.find(".con-icon").attr("aria-expanded","false"),"concierge-tab"===e.attr("id")&&e.attr("aria-expanded","false"))},Ds=function(){return'
\n \n
    >
\n \n\n \n
\n'};function Ns(e){this.html=Ds,this.cssType="desktop",this.notificationDisplayed=!1,this.visualViewportHasScroll=!1,this.visualViewportHasResize=!1;var t=this;this.start=function(){var n=e.$concierge.find("#concierge-tab"),i=e.$concierge.find("#concierge-widgets");n.on("mousedown",Ts),n.onPassive("touchstart",Ts),n.on("mouseleave",As);var o=function(i){("click"===i.type||fo(i.which))&&("click"===i.type&&n.removeClass("highlight"),on(this).removeClass("con-pressed").data("pressing",0).attr("aria-expanded","false"),Ui(e.concierge,!1),tr("bellClicked",{}),t.toggleWindow())};n.on("click",o),n.on("keypress",o),n.on("keyup",(function(e){go(e.which)?on(this).addClass("highlight"):vo(e.which)?r(on(this)):po(e.which)&&a(on(this))})),n.on("blur",(function(){on(this).removeClass("highlight")})),Lt(i,"mousedown",Pt("li"),Ts),Lt(i,"touchstart",Pt("li"),Ts,!0),Lt(i,"mouseleave",Pt("li"),As);var s=function(t){("click"===t.type||fo(t.which))&&(on(this).removeClass("con-pressed").data("pressing",0),on(this).find(".con-icon").attr("aria-expanded","false"),rr((function(){return function(e,t){var n=on(t.target).closest("li"),i=n.data("spot"),r=Ua(e.wmState,i);if(r){if(r.buttonEnabled){var a=r.name,o=Eo(a),s=r.parameters;return n.removeClass("highlight"),(s=s||{}).rule=s.rule||{},s.rule.source="button",rr((function(){return n.hasClass("con-active")?e.hideWidget(!1):xs(e,r)})).then((function(){return Ui(e.concierge,!0,a),tr("buttonClicked",{buttonName:o}),null}))}}else me.log("DesktopWidgets: widgetsClicked: could not find widget for spot, "+i)}(e,t)})).catch((function(e){me.log((e.stack,e.stack))})))};Lt(i,"click",Pt("li"),s),Lt(i,"keypress",Pt("li"),s);var c=function(t){if("click"===t.type||fo(t.which)||ho(t.which)){var n=on(t.target);n.hasClass("con-x")||n.closest(".con-x").length>0?eo(e.wmState):Za(e.wmState)}};e.$concierge.find("#con-notification").on("click",c).on("keypress",c)},this.notificationAccepted=function(){var n=e.wmState.notification;n&&n.shouldDisplayBell()&&e.$concierge.hasClass("con-closed")&&(t.toggleWindow(),e.state=gs)},this.toggleWindow=function(){Is.call(this,e)},this.openWidgetMenu=function(){_s.call(this,e)},this.focusWidgetButton=function(t){e.$concierge.find("#concierge-widgets li[data-widget="+t+"] .con-icon").focus()};function n(e,t,n){if(qa(e.wmState)){n=n||{};var i=0,r=e.wmState.notification,a=Oo(r.spot);a.length>0&&!Io(e)&&e.$concierge.hasClass("with-widgets")&&(i=65*ps(e,a)),n[vs(e)?"top":"bottom"]=i,t.css(n);var o=!0;if(r.spot){var s=Ra(e.wmState,r.spot);s.widget&&s.widget.preferredSpotName()===r.preferredSpotName()&&(o=!1)}o?function(e){e.addClass(So)}(t):function(e){e.removeClass(So)}(t)}}this.makeWidgetActive=function(e){e.addClass("con-active")},this.makeWidgetInactive=function(e){e.removeClass("con-active")},this.openWidget=function(t){var n=t.name,i=e.$concierge.find("#concierge-widget-area");!function(e,t){var n={kb:"K B Engagement Widget",chat:"Live Chat",kbot:"Live Chat",email:"Email Engagement Widget","cxone-expert":"CXone Expert Widget"}[e]||"";t.attr("aria-label",n)}(n,i);var r=e.widgetAreaForWidget(n),a=i.children(".concierge-widget.con-active").not(r);function o(){on(this).removeAttr("style")}this.makeWidgetInactive(a),this.makeWidgetActive(r),e.$concierge.find("#concierge-widgets li.con-active").removeClass("con-active").removeClass("con-pressed"),e.$concierge.find("#concierge-widgets li.con-active .con-icon").attr("aria-expanded","false"),e.device===An&&r.find("iframe.widget-content").css({overflow:"auto"});var s=e.$concierge.find("#concierge-widgets li[data-widget="+n+"]");s.addClass("con-active").addClass("con-pressed"),s.find(".con-icon").attr("aria-expanded","true"),e.state===fs&&a.length>0&&(me.log("openWidget(): invoked and willHide sent to already opened widget -"+a.data("widget")),Cs(e),e.postMessageToWidget(a.data("widget"),"willHide"),r.css({opacity:.3}),ee(r,ns,{opacity:1},{label:"desktopOpenWidget",done:o}),a.css({display:"block",position:"absolute",top:2,height:"calc(100% - 4px)",width:"100%","padding-right":"4px",opacity:1,"z-index":100}),ee(a,ns,{opacity:0},{label:"desktopCloseWidget",done:o})),ks(e,s)},this.closeWidgets=function(){e.$concierge.find("#concierge-widgets li.con-active").removeClass("con-active").removeClass("con-pressed"),e.$concierge.find("#concierge-widgets li.con-active .con-icon").attr("aria-expanded","false");var t=e.$concierge.find("#concierge-widget-area .concierge-widget.con-active");this.makeWidgetInactive(t),t.removeAttr("style"),Es(e,t),e.$concierge.find("#concierge-widget-area").removeClass("con-open"),e.state=ds},this.getNotification=function(){return e.$concierge.find("#con-notification")},this.getNotificationBody=function(){return e.$concierge.find("#con-notification-body")},this.getNotificationTitle=function(){return e.$concierge.find("#con-notification-title")},this.setAriaHidden=function(e){this.getNotificationBody().attr("aria-hidden",e),this.getNotificationTitle().attr("aria-hidden",e)},this.canDisplayNotification=function(){return!this.notificationDisplayed&&!e.$concierge.hasClass("con-open-widget")},this.maybeHandleOffset=function(){var t;0===e.tabStyle.verticalAnchor?t=window.visualViewport.offsetTop:(t=0,ht()&&(t=window.visualViewport.height-gt()+window.visualViewport.offsetTop,t=Math.min(t,0))),this.conciergePrevOffset!==t&&(this.conciergePrevOffset=t,this.conElem.style.transform="translateY("+t+"px) scale("+1/window.visualViewport.scale+")",e.dragResizeHandler())},this.viewportHandler=function(e){this.conElem&&this.maybeHandleOffset()},this.applyKeyboardOffset=function(){this.conElem=Me("concierge"),window.visualViewport&&(this.visualViewportHasScroll||(this.visualViewportHasScroll=!0,xt(window.visualViewport,"scroll",this.viewportHandler.bind(this))),this.visualViewportHasResize||(this.visualViewportHasResize=!0,xt(window.visualViewport,"resize",this.viewportHandler.bind(this))))},this.resetKeyboardOffset=function(){this.conElem=null,window.visualViewport&&(this.visualViewportHasScroll&&(this.visualViewportHasScroll=!1,Dt(window.visualViewport,"scroll",this.viewportHandler.bind(this))),this.visualViewportHasResize&&(this.visualViewportHasResize=!1,Dt(window.visualViewport,"resize",this.viewportHandler.bind(this))))},this.updateNotification=function(){var t=this.getNotification();n(e,t,{})},this.displayNotification=function(){var t=this;this.notificationDisplayed=!0;var r=this.getNotification();r.addClass("con-active").removeClass("con-inactive"),this.setAriaHidden("false"),r.removeAttr("style");n(e,r,{opacity:0}),ee(r,ns,{opacity:1},{label:"desktopShowNotification",done:function(e,n){delete t.$notifAnimate,n||"object"!==i(window.visualViewport)||t.applyKeyboardOffset()}}),t.$notifAnimate=r},this.closeNotification=function(){"object"===i(window.visualViewport)&&this.resetKeyboardOffset();var e=this;this.notificationDisplayed=!1;var t=this.getNotification();t&&(ee(t,ns,{opacity:0},{label:"desktopHideNotification",done:function(){delete e.$notifAnimate,t.addClass("con-inactive").removeClass("con-active").removeAttr("style"),e.setAriaHidden("true")}}),e.$notifAnimate=t)},this.openConcierge=function(t){e.state!==fs&&(e.state=gs);var n=e.$concierge.find("#concierge-widgets");e.$concierge.addClass("with-widgets").removeClass("con-closed");var i=e.$concierge.find("#concierge-tab");if(i.addClass("con-pressed"),i.attr("aria-expanded","true"),n.addClass("con-visible"),t)return xs(e,t)};var r=function(t){if(!Io(e)){var n=null;1===(n="concierge-tab"===t.attr("id")?on("#concierge-widgets-ul li").last():t.prev()).length?(n.find(".con-icon").focus(),n.addClass("highlight")):on("#concierge-tab").focus().addClass("highlight")}},a=function(t){if(!Io(e)){var n=null;1===(n="concierge-tab"===t.attr("id")?on("#concierge-widgets-ul li").first():t.next()).length?(n.find(".con-icon").focus(),n.addClass("highlight")):on("#concierge-tab").focus().addClass("highlight")}};this.createWidgetElement=function(t){var n=Io(e)?"":' role="menuitem"',i=e.concierge.getTranslation(Eo(t.name),"title"),o="";t.buttonEnabled||(o="disabled");var s=on('
  • "),c=s.find("svg");c.length>0&&xo(c[0]);var u=s.find(".con-icon");return u.on("keyup",(function(e){go(e.which)?s.addClass("highlight"):vo(e.which)?r(s):po(e.which)&&a(s)})),u.on("blur",(function(){s.removeClass("highlight")})),s},this.updateWidgetElement=function(t){var n=Oo(t.spot);if(n.length>0){n.attr("data-widget",t.name);var i=e.concierge.getTranslation(Eo(t.name),"title"),r=n.find("button");r.attr("aria-label",i),r.html(t.icon.svg);var a=n.find("svg");a.length>0&&xo(a[0])}},this.addWidget=function(t){me.log("DesktopWidgets: addWidget:",t.name,t);var i=on("#concierge-widgets ul"),r=this.createWidgetElement(t);return i.append(r[0]),Mo(e,vs(e)),n(e,this.getNotification()),Io(e)&&e.$concierge.removeClass("con-closed"),r};var o=function(t){var n={right:e.tabStyle.horizontalOffset,bottom:""},i=window.pageYOffset;0===e.tabStyle.verticalAnchor?n.top=e.tabStyle.verticalOffset+i:n.top=i+gt()-(e.tabStyle.verticalOffset+50),t.css(n)},s=function(t){var n={right:e.tabStyle.horizontalOffset};0===e.tabStyle.verticalAnchor?n.top=e.tabStyle.verticalOffset:n.bottom=e.tabStyle.verticalOffset,t.css(n)};this.fixPosition=function(e,t){"javascript"===e?(t.addClass("position-method-javascript"),me.log("Concierge Client: PositionMethod - Javascript"),this.scrollHandler||(this.scrollHandler=function(){o(t)},xt(window,"scroll",this.scrollHandler)),o(t)):s(t)},this.beforeAppend=function(t){var n=[],i={right:e.tabStyle.horizontalOffset};s(t),vs(e)?n.push("con-top"):n.push("con-bottom"),t.addClass(n.join(" ")),t.css(i)},this.destroy=function(){hs(this),this.scrollHandler&&Dt(window,"scroll",this.scrollHandler),on("#concierge-style-desktop").remove(),this.resetKeyboardOffset()}}function Ms(e){this.html=function(){return'
    \n
    \n \n
    \n
      >
    \n
    \n
    \n
    \n \n\n \n
    \n'},this.cssType="mobile",this.openWidgetCount=0,this.bodyOrigStyle="",this.bodyOrigClasses="",this.htmlOrigStyle="",this.htmlOrigClasses="",this.start=function(){var t=this;navigator.userAgent.match(/instagram/i)&&navigator.userAgent.match(/iphone/i)&&(e.$concierge.addClass("instagram"),e.$concierge.find("#concierge-widget-area").css("height",window.innerHeight+"px")),e.$concierge.find("#concierge-tab").onPassive("touchstart",(function(){on(this).addClass("con-pressed").attr("aria-expanded","true"),function(e){var t=e.$concierge.find("#concierge-widgets");if(Ls(e,t),Io(e)){var n=Ra(e.wmState,"single").widget;me.log("widget "+n.name+" clicked");var r=Eo(n.name);Ui(e.concierge,!0,n.name),tr("buttonClicked",{buttonName:r}),n.parameters.rule.source="button",n.execute(e)}else!function(e){e.$concierge.hasClass("con-open")||!e.shouldDisplayBell?Ws(e):function(e){var t=e.$concierge.find("#concierge-widgets");e.$concierge.find("#concierge-tab").attr("aria-expanded","true"),Ls(e,t),t.data("animation","opening"),e.$concierge.removeClass("con-pressed").removeClass("con-closed");var n=t.attr("style");t.removeAttr("style");var r=t.height();"undefined"===i(n)||!1===n?t.css({overflow:"hidden",opacity:0,height:0}):t.attr("style",n);Z(t,ns,{height:r,opacity:1},{label:"mobileOpenMenu",done:function(){t.data("animation",!1),t.removeAttr("style"),e.$concierge.addClass("con-open")}})}(e)}(e)}(e)})).on("touchend",(function(){on(this).removeClass("con-pressed")})),e.$concierge.onPassive("touchstart",".con-widgets li",(function(){on(this).addClass("con-pressed"),on(this).find(".con-icon").attr("aria-expanded","true")})).on("touchend",".con-widgets li",(function(){var t=on(this);t.removeClass("con-pressed"),t.find(".con-icon");var n=t.data("spot"),i=Ua(e.wmState,n);if(i){var r=i.name;return i.parameters.rule.source="button",me.log("widget "+r+" clicked"),i.execute(e).then((function(){return Ui(e.concierge,!0,r),tr("buttonClicked",{buttonName:Eo(r)}),!1}))}me.log("MobileWidgets: widgetsClicked: could not find widget for spot, "+n)})),e.$concierge.find("#concierge-backdrop").on("click",(function(){to(e.wmState),Ws(e)}));var n=function(t){if("click"===t.type||fo(t.which)||ho(t.which)){var n=on(t.target);n.hasClass("con-x")||n.closest(".con-x").length>0?eo(e.wmState):Za(e.wmState)}};e.$concierge.find("#con-notification").on("click",n),e.$concierge.find("#con-notification").on("keypress",n);var r=!1;this.orientationListener=function(){if(t.notificationDisplayed){var e=t.getNotification();r&&clearTimeout(r),r=setTimeout((function(){r=!1,e.css({width:ft()})}),500)}},window.addEventListener("orientationchange",this.orientationListener)},this.notificationAccepted=function(){},this.focusWidgetButton=function(t){Io(e)?e.$concierge.find("#concierge-tab").focus():e.$concierge.find("#concierge-widgets li[data-widget="+t+"]").focus()};this.addScrollFix=function(){var e=on("html");this.htmlOrigStyle=e.attr("style"),this.htmlOrigClasses=e.attr("class"),e.attr("style",""),e.attr("class",""),e.addClass("concierge-modal-displayed");var t=on("body");this.bodyOrigStyle=t.attr("style"),this.bodyOrigClasses=t.attr("class"),t.attr("style",""),t.attr("class",""),t.addClass("concierge-modal-displayed"),this.scrollFixApplied=!0},this.removeScrollFix=function(){if(this.scrollFixApplied){var e=on("html");e.removeClass("concierge-modal-displayed"),e.attr("style",this.htmlOrigStyle),delete this.htmlOrigStyle,e.attr("class",this.htmlOrigClasses),delete this.htmlOrigClasses;var t=on("body");t.removeClass("concierge-modal-displayed"),t.attr("style",this.bodyOrigStyle),delete this.bodyStyleRemoved,t.attr("class",this.bodyOrigClasses),delete this.bodyOrigClasses,on("#concierge-widget-area").css({top:""}),delete this.scrollFixApplied}},this.makeWidgetActive=function(e){e.length>0&&(0===this.openWidgetCount&&this.addScrollFix(),e.addClass("con-active"),this.openWidgetCount+=e.length)},this.makeWidgetInactive=function(e){e.length>0&&(e.removeClass("con-active"),this.openWidgetCount-=e.length,0===this.openWidgetCount&&this.removeScrollFix())};this.openWidget=function(t){var n=t.name;!function(e,t){var n={kb:"K B Engagement Widget",chat:"Live Chat",kbot:"Live Chat",email:"Email Engagement Widget","cxone-expert":"CXone Expert Widget"}[e]||"";t.attr("aria-label",n)}(n,e.$concierge.find("#concierge-widget-area"));var i=e.widgetAreaForWidget(n),r=e.$concierge.find("#concierge-widget-area .concierge-widget.con-active").not(i),a=this;this.makeWidgetActive(i),this.$widgetAnimating=i,function(e){var t=e.$concierge;e.engagementWidgets.globalSettings.hideMoxieBranding&&t.addClass("hide-moxie")}(e),i.attr("aria-expanded","true"),i.css({"z-index":1,opacity:0}),ee(i,ns,{opacity:1},{label:"mobileOpenWidget",done:function(){delete a.$widgetAnimating,a.makeWidgetInactive(r),r.attr("aria-expanded","false"),i.removeAttr("style")}}),Ws(e)},this.closeWidgets=function(){var t=e.$concierge.find("#concierge-widget-area .concierge-widget.con-active"),n=this;t.css({opacity:1}),Z(t,ns,{opacity:0},{label:"mobileCloseWidgets",done:function(){me.log("close complete"),n.makeWidgetInactive(t),t.removeAttr("style").attr("aria-expanded","false")}})},this.getNotification=function(){return e.$concierge.find("#con-notification")},this.getNotificationBody=function(){return e.$concierge.find("#con-notification-body")},this.getNotificationTitle=function(){return e.$concierge.find("#con-notification-title")},this.setAriaHidden=function(e){this.getNotificationBody().attr("aria-hidden",e),this.getNotificationTitle().attr("aria-hidden",e)},this.canDisplayNotification=function(){return!this.notificationDisplayed&&!e.$concierge.hasClass("con-open-widget")},this.fixPosition=function(e,t){if("javascript"===e){t.addClass("position-method-javascript"),me.log("Concierge Client: PositionMethod - Javascript");var n=function(){var e=gt();t.css({top:e})};window.addEventListener("scroll",n),n()}};var t=!1,n=this;this.fixNotificationsUsingVisualViewport=function(){var e=Me("con-notification");e&&(t=!1,e.style.transform="translateY("+window.visualViewport.offsetTop+"px) scale("+1/window.visualViewport.scale+")")},this.viewportHandler=function(){t||(t=!0,is(n.fixNotificationsUsingVisualViewport,"mobileNotifScrollFix"))},this.applyNotificationKeyboardOffset=function(){window.visualViewport.addEventListener("scroll",this.viewportHandler),window.visualViewport.addEventListener("resize",this.viewportHandler),this.viewportHandler()},this.resetNotificationKeyboardOffset=function(){window.visualViewport.removeEventListener("scroll",this.viewportHandler),window.visualViewport.removeEventListener("resize",this.viewportHandler)},this.updateNotification=function(){},this.displayNotification=function(t){var n=this;this.notificationDisplayed=!0,me.log("opening notification.");var r=this.getNotification();r.data("parameters",t.parameters),r.addClass("con-active").removeClass("con-inactive"),this.setAriaHidden("false");var a="0px";e.engagementWidgets.globalSettings.notificationMobileVerticalOffset&&(a=e.engagementWidgets.globalSettings.notificationMobileVerticalOffset.toString()+"px"),n.$notifAnimating=r,r.css({top:"-150px"}),Z(r,ns,{top:a},{label:"mobileShowNotification",done:function(){n.$notifAnimating=!1;var e=ft();r.css({width:e}),"object"===i(window.visualViewport)&&n.applyNotificationKeyboardOffset()}})},this.closeNotification=function(){"object"===i(window.visualViewport)&&this.resetNotificationKeyboardOffset();var e=this;this.notificationDisplayed=!1;var t=this.getNotification();t&&Z(t,ns,{opacity:0},{label:"mobileHideNotification",done:function(){t.addClass("con-inactive").removeClass("con-active").removeAttr("style"),e.setAriaHidden("true")}})},this.openConcierge=function(){},this.destroy=function(){this.$notifAnimating&&(Z(this.$notifAnimating,ts,!0,!0),delete this.$notifAnimating),this.$widgetAnimating&&(Z(this.$widgetAnimating,ts,!0,!0),delete this.$widgetAnimating),this.orientationListener&&(window.removeEventListener("orientationchange",this.orientationListener),delete this.orientationListener),this.removeScrollFix(),on("#concierge-style-mobile").remove()},this.createWidgetElement=function(t){var n=Io(e)?"":' role="menuitem"',i=e.concierge.getTranslation(Eo(t.name),"title");return on('
  • '+i+"
  • ")},this.updateWidgetElement=function(t){var n=Oo(t.spot),i=n.find("button");if(Io(e)){var r=on("#concierge-tab");i.pushAll(r),n.pushAll(r)}n.attr("data-widget",t.name),n.attr("data-spot",t.spot);var a=e.concierge.getTranslation(Eo(t.name),"title");n.find(".con-mobile-primary-menu").text(a),i.attr("aria-label",a),i.html(t.icon.svg);var o=i.find("svg");o.length>0&&xo(o[0])},this.addWidget=function(t){me.log("MobileWidgets: addWidget:",t.name,t);var n=on("#concierge-widgets ul"),i=this.createWidgetElement(t);if(n.append(i[0]),Mo(e,!0),Io(e)){var r=on("#concierge-tab");return r.html(t.icon.svg),r.attr("data-widget",t.name),r.attr("data-spot",t.spot),r}return i}}function Ls(e,t){var n=t.data("animation");return n&&("opening"===n?(t.stop(),e.$concierge.addClass("con-open")):"closing"===n&&t.stop(),t.data("animation",!1)),n}function Ws(e){var t=e.$concierge.find("#concierge-widgets");(e.$concierge.find("#concierge-tab").attr("aria-expanded","false"),e.$concierge.hasClass("con-closed"))||"closing"!==t.data("animation")&&(Ls(e,t),t.data("animation","closing"),e.$concierge.removeClass("con-pressed").removeClass("con-open"),t.css({overflow:"hidden"}),Z(t,ns,{opacity:0,height:0},{label:"mobileCloseMenu",done:function(){t.data("animation",!1),t.removeAttr("style"),e.$concierge.addClass("con-closed")}}))}function Rs(){}function Ps(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function js(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{};e(this,t),this.hasFinished=!1,this.autoOpen=!1,wn(this,i),this.parameters=this.parameters||{},this.configuration=this.configuration||{},this.configuration.connectorUrl=n.serviceUrl.connector,Vs(this,n)}return n(t,[{key:"preferredSpotName",value:function(){return this.name}},{key:"getSpotName",value:function(){return this.spot}},{key:"label",value:function(){var e=fa(this,"parameters","rule","name");return e?"".concat(this.name,":").concat(e):this.name}},{key:"checkAvailability",value:function(){return F.resolve({status:!0})}},{key:"shouldDisplayBell",value:function(){return!0}},{key:"beforeNotify",value:function(e){return F.resolve(qs(e,!0))}},{key:"beforeAdd",value:function(e){return F.resolve(qs(e,!0))}},{key:"getRemoteURL",value:function(){if(this.remoteURL)return this.remoteURL}}]),t}();function Vs(e,t){var n=t.widgetManager;e.priority=1,e.state=0,e.buttonEnabled=!0,e.hideWidget=function(){n.wmState.open===this&&n.hideWidget(!1)},e.closeWidget=function(){if(this.spot){var e=Ra(n.wmState,this.spot);this.hasFinished=!0,e.widget===this&&e.reactive&&e.reactive!==this&&$a(n.wmState,e.reactive)}},e.destroy=function(){},e.unload=function(){0!==this.state&&(n.widgetAreaForWidget(this.name).remove(),this.state=0)},e.beforeLoad=function(){},e.execute=function(e){var t=this;return e.concierge.cacheManager.removeWidgetCache(this.name,"widget-closed").then((function(){e.showWidget(t)}))}}function qs(e,t){return js(js({},e),{},{status:t})}var Bs,Hs=Object.prototype.propertyIsEnumerable;function $s(e){if(null==e)throw new TypeError("Sources cannot be null or undefined");return Object(e)}function Us(e,t,n){var i=t[n];if(null!=i)if(re(e,n)){if(void 0===e[n]||null===e[n])throw new TypeError("Cannot convert undefined or null to object ("+n+")");ae(i)?e[n]=Js(Object(e[n]),i):e[n]=i}else ae(i)?e[n]=Js(Object({}),i):e[n]=i}function Js(e,t){if(e===t)return e;for(var n in t=Object(t))re(t,n)&&Us(e,t,n);if(Object.getOwnPropertySymbols)for(var i=Object.getOwnPropertySymbols(t),r=0;r=0&&(t=e.getResponseHeader("x-trace-id")),t}function zs(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=U(e);if(t){var r=U(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return X(this,n)}}var Ks=function(t){z(r,t);var i=zs(r);function r(t,n){var a;return e(this,r),ec(K(a=i.call(this,t,n)),t),function(e,t){var n=t.widgetManager,i=t.cacheManager;e.beforeAdd=function(e){var r,a,o=e.ref,s=e.parameters,c=Qs(n.device),u=o.name,l=o.getEngagmentId(),d=o.getSuspendedSession(),g=o.getActiveSession();if(!e.ruleSettings)throw new Error("obj.ruleSettings is missing");return a=e.ruleSettings.skip_chat_queue_status_check?t.serviceUrl.connector+"/connector/channels/portal_with_service_line/"+s.portalId+"/device/"+c:t.serviceUrl.connector+"/connector/channels/portals_with_queue_status/"+s.portalId+"/device/"+c,t.httpGetXMLHttpRequest(a).then((function(a){var c,f=JSON.parse(a.responseText);if(s.traceId=Gs(a),e.ruleSettings.skip_chat_queue_status_check)s.serviceLineId||(s.serviceLineId=f.response.serviceLineId,s.serviceLine=f.response.serviceLineName),t.serviceLines.setName(s.serviceLineId,s.serviceLine),c=f.response;else{if(s.serviceLineId||(s.serviceLineId=f.response.queueStatus.id,s.serviceLine=f.response.queueStatus.name),t.serviceLines.setName(s.serviceLineId,s.serviceLine),!f.response)throw new Error("status.response evaluates to false");var h=s.rule&&s.rule.source?s.rule.source:"internal";if(!wo(h)&&e.ruleSettings.hide_on_demand_chat_when_service_line_is_closed&&"true"!==f.response.queueStatus.queueopen)throw new Error("service line is closed");if(r="true"===f.response.queueStatus.slotavailable,!wo(h)&&e.ruleSettings.hide_on_demand_chat_when_no_available_agent_slots&&!r&&!d&&!g&&!e.engagementId)throw new Error("spot not available");Lo(e.ruleSettings.check_queue_wait_time_for_on_demand_chat,fa(f,"response","queueStatus","holdtime"),e.ruleSettings.queue_wait_time,d,g),c=f.response.portalData}s.widgetpath=t.scriptLocationWithBrand+"/widgets/chat/"+t.assetVersion.widgets+"/",s.langOptions=t.langOptions;var v=0;c.deviceList.length>1&&(v=Qs(n.device));var p="<%=host %>/netagent/cimlogin.aspx?questid=<%=questId %>&portid=<%=portalId %>&defaultStyleId=<%=styleId %>&widgetpath=<%=widgetpath %>&nareferer=<%=nareferer %>&flyout=1";p=$o(p)({host:s.host,questId:c.deviceList[v].questid,styleId:c.deviceList[v].styleid,portalId:c.deviceList[v].styleid,widgetpath:t.scriptLocationWithBrand+"/widgets/chat/"+t.assetVersion.widgets+"/",nareferer:encodeURIComponent(window.location.href)}),("string"==typeof o.remoteURL||o.remoteURL instanceof String)&&(o.remoteURL={}),o.portalId=s.portalId,o.remoteURL[s.portalId]=p,o.oldRemoteUrl=p,navigator.appVersion&&-1!==navigator.appVersion.indexOf("MSIE 10")?o.remoteURL[s.portalId]+="&fullScreen=false":n.device!==Dn&&n.device!==An||(o.remoteURL[s.portalId]+="&fullScreen=true"),e.engagementId&&e.engagementId!==l&&(l=!1);var m=0!==n.notificationType;return s.questId=c.deviceList[v].questid,s.styleId=c.deviceList[v].styleid,o.shouldReplaceIframeSrc=!0,d&&l?(m&&n.widgetsType.closeNotification(),i.removeWidgetCache(u,"suspended_session",!0),void(o.autoOpen=!0)):n.loadingActiveWidgets&&g&&l?(o.origRemoteURL=o.remoteURL,o.oldRemoteUrl=o.remoteURL[s.portalId],o.remoteURL[s.portalId]=$o(g)({host:s.host,widgetpath:t.scriptLocationWithBrand+"/widgets/chat/"+t.assetVersion.widgets+"/"}),navigator.appVersion&&-1!==navigator.appVersion.indexOf("MSIE 10")?o.remoteURL[s.portalId]+="&fullScreen=false":n.device!==Dn&&n.device!==An||(o.remoteURL[s.portalId]+="&fullScreen=true"),t.cacheManager.getWidgetCache(u,"widget-closed")||m?n.loadWidget(o):void(o.autoOpen=!0)):void 0})).then((function(){return e.status=!0,e}))},e.beforeNotify=function(i){var r=t.rulesEngine,a=Qs(n.device),o=60;r.queueWaitTime&&(o=r.queueWaitTime());var s=i.rule,c=null;s&&s.id?c=s.id:me.log("Chat Widget:beforeNotify: rule id missing from obj:",i);var u=i.parameters,l=t.serviceUrl.connector+"/connector/channels/queue_status/"+u.portalId+"/device/"+a;return t.httpGetXMLHttpRequest(l).then((function(r){var a=JSON.parse(r.responseText);u.traceId=Gs(r);var s=a.response.id;if(u.serviceLineId=a.response.id,u.serviceLine=a.response.name,t.serviceLines.setName(u.serviceLineId,u.serviceLine),t.cacheManager.getWidgetCache(e.name,"suspended_session",!0))return i.status=!1,function(e,t){for(var n=e.getData(Fn),i=n.session.visits.length-1,r=0;r=o?(d.chat.missed_reason=3,$i(t,"wait-too-long",s,c,"proactive",u.traceId)):"false"===a.response.agentavailable?(d.chat.missed_reason=1,$i(t,"no-agent-available",s,c,"proactive",u.traceId)):"true"!==a.response.slotavailable&&$i(t,"no-agent-slots-available",s,c,"proactive"),n.setEngagementRecord(i.engagementId,d),i.status=!1}return i}))},e.startNewSession=function(){var n=t.widgetManager,r=Qs(n.device),a=t.serviceUrl.connector+"/connector/channels/queue_status/"+e.parameters.portalId+"/device/"+r;return t.httpGet(a).then((function(r){if(e.shouldReplaceIframeSrc){var a=e.getRemoteURL();"true"!==r.response.slotavailable&&(a=Zs(i,e.oldRemoteUrl)),navigator.appVersion&&-1!==navigator.appVersion.indexOf("MSIE 10")?a+="&fullScreen=false":n.device!==Dn&&n.device!==An||(a+="&fullScreen=true"),on("#concierge-widget-chat .widget-content").attr("src",a)}else on("#concierge-widget-chat iframe.widget-content").replaceWith(''),t.widgetManager.writeSrcToIframe(e.name)}))},e.checkAvailability=function(e){var i=e.parameters,r=Qs(n.device);if(!e.ruleSettings)return F.resolve({status:!1});var a=t.serviceUrl.connector+"/connector/channels/queue_status/"+i.portalId+"/device/"+r;return t.httpGet(a).then((function(t){return t.response?e.ruleSettings.hide_on_demand_chat_when_service_line_is_closed&&"true"!==t.response.queueopen||e.ruleSettings.hide_on_demand_chat_when_no_available_agent_slots&&"true"!==t.response.slotavailable||e.ruleSettings.check_queue_wait_time_for_on_demand_chat&&parseInt(t.response.holdtime,10)>e.ruleSettings.queue_wait_time?{status:!1}:{status:!0}:{status:!1}})).catch((function(e){return me.log("checkAvailability error thrown: "+e),{status:!1}}))},e&&e.titleBar&&(e.titleBar.onclick=function(){n.hideWidget(!1),tr("widgetMinimized",{widgetName:e.name})})}(K(a),t),a}return n(r)}(Fs),Xs=(H(Bs={},Dn,1),H(Bs,An,2),H(Bs,Tn,3),Bs);function Qs(e){var t=Xs[e];return t||(t=0),t}var Ys=function(e){return parseInt(e)};function Zs(e,t){var n,r=e.getVolatileData(Bn);if(function(e,t){if(e)for(var n=t.split("&"),i=0;i0&&n.handleBroadcast(o,"chatSessionStarted",{sessionId:s})}},e.beforeLoad=function(){t.widgetManager.channelsWidget=this}}function tc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=U(e);if(t){var r=U(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return X(this,n)}}var nc=function(t){z(r,t);var i=tc(r);function r(t,n){var a;return e(this,r),(a=i.call(this,t,n)).baseHideWidget=a.hideWidget,a.hideWidget=function(){this.baseHideWidget(),this.closeWidget()},a}return n(r)}(Fs);function ic(e,t,n,i,r,a,o,s){Object.defineProperty(this,"name",{value:t,enumerable:!0,writable:!1}),Object.defineProperty(this,"maxLength",{value:n,enumerable:!0,writable:!1}),Object.defineProperty(this,"required",{value:i,enumerable:!0,writable:!1}),Object.defineProperty(this,"label",{value:r,enumerable:!0,writable:!1}),Object.defineProperty(this,"type",{value:a,enumerable:!0,writable:!1}),Object.defineProperty(this,"defaultvalue",{value:o,enumerable:!0,writable:!1}),Object.defineProperty(this,"options",{value:s,enumerable:!0,writable:!1}),this.hide=e}function rc(){this.hide=!1,this.questions=[]}function ac(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=U(e);if(t){var r=U(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return X(this,n)}}ic.prototype.setAnswer=function(e){var t=void 0!==e.hide?e.hide:this.hide;if("16"===this.type||"15"===this.type||"4"===this.type||"6"===this.type){for(var n=0;n1&&(o=Qs(n.device));var u="<%=host %>/netagent/cimlogin.aspx?questid=<%=questId %>&portid=<%=portalId %>&defaultStyleId=<%=styleId %>&widgetpath=<%=widgetpath %>&flyout=1";(!s.remoteURL||"string"==typeof s.remoteURL||s.remoteURL instanceof String)&&(s.remoteURL={}),s.portalId=c.portalId,s.remoteURL[c.portalId]=$o(u)({host:c.host,questId:a.response.deviceList[o].questid,styleId:a.response.deviceList[o].styleid,portalId:a.response.deviceList[o].styleid,widgetpath:t.scriptLocationWithBrand+"/widgets/kbot/"+t.assetVersion.widgets+"/"}),s.hashedQuestId=a.response.deviceList[o].questid,s.hashedPortalId=a.response.deviceList[o].styleid,navigator.appVersion&&-1!==navigator.appVersion.indexOf("MSIE 10")?(c.fullScreen=!1,s.remoteURL[c.portalId]+="&fullScreen=false"):n.device!==Dn&&n.device!==An||(c.fullScreen=!0,s.remoteURL[c.portalId]+="&fullScreen=true"),r.engagementId&&r.engagementId!==l&&(l=!1);var d=0!==n.notificationType;if(c.questId=a.response.deviceList[o].questid,c.styleId=a.response.deviceList[o].styleid,i.getWidgetCache("kbot","suspended_session",!0)&&l)return d&&n.widgetsType.closeNotification(),e.shouldReplaceIframeSrc=!0,i.removeWidgetCache("kbot","suspended_session",!0),void(e.autoOpen=!0);var h=i.getWidgetCache("kbot","widget-closed");if(n.loadingActiveWidgets&&g&&l)return e.shouldReplaceIframeSrc=!0,s.origRemoteURL=s.remoteURL,s.oldRemoteUrl=s.remoteURL[c.portalId],s.remoteURL[c.portalId]=$o(g)({host:c.host,widgetpath:t.scriptLocationWithBrand+"/widgets/kbot/"+t.assetVersion.widgets+"/"}),h||d?n.loadWidget(e):void(e.autoOpen=!0);if(n.loadingActiveWidgets&&f&&l){var v=i.getWidgetCache("kbot","shouldReopen",!1);return h||d||!v?n.loadWidget(e):void(e.autoOpen=!0)}})).then((function(){return r.status=!0,r}))},e.beforeNotify=function(e){return F.resolve(qs(e,!1))},e.startNewSession=function(){var e=t.widgetManager.createEngagementRecord(this,"kb");i.setWidgetCache("kbot",Jn,e,!0),i.removeWidgetCache("kbot","active_session"),i.removeWidgetCache("kbot","surveyOpen"),on("#concierge-widget-kbot iframe.widget-content").replaceWith(''),t.widgetManager.writeSrcToIframe("kbot"),delete this.shouldReplaceIframeSrc},e.createChatEngagementRecord=function(){var e=t.widgetManager.createEngagementRecord(this,"chat");return i.setWidgetCache("kbot",Jn,e,!0),{id:e,data:t.widgetManager.getEngagementRecord(e)}}}(K(a),t),a}return n(r)}(Fs);function sc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=U(e);if(t){var r=U(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return X(this,n)}}var cc=function(t){z(r,t);var i=sc(r);function r(t,n){var a;return e(this,r),function(e,t){e.beforeAdd=function(n){if(n.parameters.langOptions=t.langOptions,!n.ruleSettings)throw new Error("obj.ruleSettings is missing");return e.parameters.ruleSettings=n.ruleSettings,n.status=!0,F.resolve(n)}}(K(a=i.call(this,t,n)),t),a}return n(r)}(Fs);function uc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=U(e);if(t){var r=U(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return X(this,n)}}var lc=function(t){z(r,t);var i=uc(r);function r(t,n){var a;return e(this,r),function(e,t){e.preferredSpotName=function(){return Na},e.beforeAdd=function(n){if(n.parameters.langOptions=t.langOptions,!n.ruleSettings)throw new Error("obj.ruleSettings is missing");return e.parameters.ruleSettings=n.ruleSettings,n.status=!0,F.resolve(n)}}(K(a=i.call(this,t,n)),t),a}return n(r)}(Fs);function dc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=U(e);if(t){var r=U(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return X(this,n)}}var gc=function(t){z(r,t);var i=dc(r);function r(t,n){var a;return e(this,r),function(e,t){function n(e){if(!t.widgetManager.isMobile()){var n=t.widgetManager.tabStyle.verticalOffset+"px",i=Me(hc);brandembassy("setOffsetX",77+t.widgetManager.tabStyle.horizontalOffset),e?(Qt(i,"top"),Kt(i,"bottom",n=t.widgetManager.tabStyle.verticalOffset+3+"px")):(Kt(i,"top",n),Qt(i,"bottom"))}}e.preferredSpotName=function(){return Da},e.icon={svg:t.widgetManager.engagementWidgets?t.widgetManager.engagementWidgets.widgets.chat.icon.svg:""},e.execute=function(t){var n=this;return e.setUpBrandEmbassyObserverThatAlsoRemovesHiddenClass(),e.showDFOWidget().then((function(){return t.showWidget(n)}))},e.beforeNotify=function(n){var i=t.cacheManager.getWidgetCache(e.name,pc,!0);return n.status=!0,"false"==i&&(n.status=!1),F.resolve(n)},e.determineDFOState=function(n){if("undefined"==typeof brandembassy)return e.addDFOToPage(n.parameters.brand_id,n.parameters.brand_hash,n.parameters.chat_file_url),n.status=!0,F.resolve(n);var i=t.cacheManager.getWidgetCache(e.name,pc,!0);return"false"!=i&&0!=i&&null!=i||(co(t.widgetManager.wmState,e),e.execute(t.widgetManager),n.parameters.proactive?n.status=!1:n.status=!0),F.resolve(n)},e.beforeAdd=function(n){return e.setUpListenerForActiveChatRecovery(),"undefined"!=typeof brandembassy&&brandembassy("hideChatWindow"),e.getChatStatus(n.parameters.base_chat_service_url,n.parameters.brand_id,n.parameters.brand_hash,t).then((function(i){if(i==ii)return e.determineDFOState(n);throw n.parameters.proactive&&$i(t,"service-line-closed",n.parameters.channel_id,n.parameters.rule.id,n.parameters.proactive),new Error("There are No Agents")}))},e.destroy=function(){e.clearActiveSessionPoll(),e.observer.disconnect(),e.initObserver.disconnect(),e.addHiddenObserver.disconnect(),Dt(window,"message",e.processEventFromDFO)},e.getChatStatus=function(e,t,n,i){return i.httpGet("".concat(e,"/chat/1.0/brand/").concat(t,"/channel/").concat(n)).then((function(e){return e.availability.status})).catch((function(e){return me.warn(e),"offline"}))},e.injectCSS=function(){var e=t.widgetManager.engagementWidgets.conciergeTab.tabStyle.tabColor;brandembassy("setCustomCss",'\n [data-selector="HEADER"] {background-color: '.concat(e,' !important;}\n [data-selector="PRIMARY_BUTTON"][type="submit"] div {background-color: ').concat(e," !important;}"))},e.showDFOWidget=function(){if(!t.widgetManager.isMobile()){var i=Me("concierge");Oe(i,"con-open"),xe(i,"con-closed");var r=Me(ti);Oe(r,vc),be(r,"style"),xe(r,"free-floating")}return t.cacheManager.setWidgetCache(e.name,pc,!0,!1),t.widgetManager.showWidget(e).then((function(){})).then((function(){brandembassy("openChatWindow"),co(t.widgetManager.wmState,e),n(t.widgetManager.tabStyle.verticalAnchor)}))},e.handlePushUpdate=function(n){var i=n.data.case.id,r=e.parameters.channel_name,a=e.parameters.channel_id,o="closed"===n.data.case.status;switch(n.eventType){case"CaseCreated":Ni(t,!0,e.name,i,r,a),co(t.widgetManager.wmState,e),e.setupActiveSessionPolling();break;case"CaseInboxAssigneeChanged":o||(n.data.inboxAssignee&&xi(t,!0,e.name,n.data.inboxAssignee.id,"".concat(n.data.inboxAssignee.firstName," ").concat(n.data.inboxAssignee.surname),i,r,a,a),n.data.previousInboxAssignee&&xi(t,!1,e.name,n.data.previousInboxAssignee.id,"".concat(n.data.previousInboxAssignee.firstName," ").concat(n.data.previousInboxAssignee.surname),i,r,a,a));break;case"CaseStatusChanged":o&&(Ni(t,!1,e.name,i,r,a,a),uo(t.widgetManager.wmState,e),e.clearActiveSessionPoll())}},e.addDFOToPage=function(t,n,i){e.setUpBrandEmbassyObserver(),function(e,t,n,i,r,a,o,s){r=a?r+"?v="+a:r,e.BrandEmbassy=i,e[i]=e[i]||function(){(e[i].q=e[i].q||[]).push(arguments)},e[i].l=+new Date,o=t.createElement(n),s=t.getElementsByTagName(n)[0],o.async=1,o.src=r+"?"+Math.round(Date.now()/1e3/3600),s.parentNode.insertBefore(o,s)}(window,document,"script","brandembassy",i),brandembassy("init",parseInt(t),n),brandembassy("setAllowedExternalMessageTypes",["CHAT_SESSION_RECOVERED"]),brandembassy("onPushUpdate",mc,(function(t){return e.handlePushUpdate(t)})),e.injectCSS()},e.setUpBrandEmbassyObserver=function(){e.addHiddenObserver=new MutationObserver((function(){var t=Me(fc);null!=t&&(Oe(t,"be-hidden"),e.addHiddenObserver.disconnect())})),e.addHiddenObserver.observe(document,{attributes:!1,childList:!0,characterData:!1,subtree:!0})},e.setUpBrandEmbassyObserverThatAlsoRemovesHiddenClass=function(){e.initObserver=new MutationObserver((function(){var i=Me(fc);null!=i&&null!=Me(hc)&&(xe(i,"be-hidden"),Oe(i,"init"),e.addListenersForBEFrame(),n(t.widgetManager.tabStyle.verticalAnchor),e.initObserver.disconnect())})),e.initObserver.observe(document,{attributes:!1,childList:!0,characterData:!1,subtree:!0})},e.addListenersForBEFrame=function(){function n(n){"be-frame-minimized"==n.className?e.multipleWidgetLogic():(t.cacheManager.setWidgetCache(ni,pc,"false",!0),Oe(Me(fc),"init"))}var i=Me(hc);_e(i,"be-frame-minimized")&&t.cacheManager.setWidgetCache(ni,pc,!0,!0),e.observer=new MutationObserver((function(){n(i)})),e.observer.observe(i,{attributes:!0,attributeFilter:["class"]})},e.multipleWidgetLogic=function(){var n,i,r=!0,a=Pe(Me("concierge-widgets-ul"),"li.con-active");(a.length>0&&(n=a[0],i=ni,we(n,"data-widget")!=i)&&(r=!1),r)&&(xe(Me(ti),vc),t.widgetManager.hideWidget(),t.cacheManager.setWidgetCache(ni,pc,!0,!0),brandembassy("hideChatWindow"),e.hasFinished=!0,null==brandembassy("getOngoingContact")&&uo(t.widgetManager.wmState,e))},e.processEventFromDFO=function(n){n.isTrusted&&"CHAT_SESSION_RECOVERED"==n.data.actionType&&n.origin==window.location.origin&&("OPEN"==n.data.action.session.status?e.execute(t.widgetManager).then((function(){e.pollActiveSession(1),e.setupActiveSessionPolling()})).catch((function(e){me.warn(e)})):(t.cacheManager.setWidgetCache(ni,pc,!0,!0),uo(t.widgetManager.wmState,e)),Dt(window,"message",e.processEventFromDFO))},e.pollActiveSession=function(n){if("undefined"!=typeof brandembassy){var i=brandembassy("getOngoingContact");i?Ti(t,i.contact.id,n,e.name):e.clearActiveSessionPoll()}else e.clearActiveSessionPoll()},e.clearActiveSessionPoll=function(){e.activeSessionPolling&&(clearInterval(e.activeSessionPolling),delete e.activeSessionPolling)},e.setupActiveSessionPolling=function(){e.activeSessionPolling||(e.activeSessionPolling=setInterval((function(){e.pollActiveSession(2)}),6e4))},e.setUpListenerForActiveChatRecovery=function(){xt(window,"message",e.processEventFromDFO)}}(K(a=i.call(this,t,n)),t),a}return n(r)}(Fs),fc="be-chat-container",hc="be-frame",vc="be-guide-frame",pc="minimized",mc=["CaseCreated","CaseInboxAssigneeChanged","CaseStatusChanged"];function wc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=U(e);if(t){var r=U(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return X(this,n)}}var yc=function(t){z(r,t);var i=wc(r);function r(t,n){var a;return e(this,r),function(e,t){e.name="bell",e.priority=0,e.buttonEnabled=!1,e.icon=fa(t,"widgetManager","engagementWidgets","conciergeTab","icon"),e.preferredSpotName=function(){return"bell"},e.execute=function(e){return F.resolve(null)}}(K(a=i.call(this,t,n)),t),a}return n(r)}(Fs);function bc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=U(e);if(t){var r=U(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return X(this,n)}}var Sc=function(t){z(r,t);var i=bc(r);function r(t,n){var a;return e(this,r),(a=i.call(this,t,n)).engagement_type=5,function(e,t){var n=t.widgetManager;e.priority=0,e.shouldDisplayBell=function(){return!1},e.preferredSpotName=function(){return null},e.beforeAdd=function(e){if(Io(n)){var i=n.wmState;if(null===i.spots.single.widget)return no(i,new yc(t,{rule:{source:"internal"},parameters:{}})).then((function(t){return qs(e,t.status)}))}return F.resolve(qs(e,!0))},e.execute=function(n){var i=this;if(!i.isExecuting){var r=this.parameters;return i.isExecuting=!0,"_blank"===r.linkStrategy?(Cc(t,r),oo(n.wmState,e),i._openTimeout=setTimeout((function(){i.isExecuting=!1,so(n.wmState,e),delete i._openTimeout}),1e3),window.open(r.url,r.linkStrategy,"noopener")):t.logDisabled?window.open(r.url,r.linkStrategy,"noopener"):(window.addEventListener("GoMoxie:PriorityEvents",(function(){window.open(r.url,r.linkStrategy,"noopener")}),!1),oo(n.wmState,e),this._openTimeout=setTimeout((function(){delete i._openTimeout,window.open(r.url,r.linkStrategy,"noopener")}),3e3),Cc(t,r)),F.resolve(null)}},e.destroy=function(t){so(t.wmState,e),this._openTimeout&&clearTimeout(this._openTimeout)}}(K(a),t),a}return n(r)}(Fs);function Cc(e,t){tr("linkFollowed",{strategy:t.linkStrategy,url:t.url}),Yi(e,t.url,t.linkStrategy,t.rule.id)}function kc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=U(e);if(t){var r=U(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return X(this,n)}}var Ec=function(t){z(r,t);var i=kc(r);function r(t,n){var a,o;return e(this,r),a=i.call(this,t,n),(o=K(a)).shouldDisplayBell=function(){return!1},o.preferredSpotName=function(){return null},o.beforeAdd=function(e){var t,n,i=va(e.parameters,"customChannel:"),r={engagementType:e.parameters.customChannelName,parameters:i};return(t=r,n=ma[t.engagementType],n?F.resolve(n.canShowEngagement?n.canShowEngagement(t):{canShow:!0}):(me.warn("[CustomActions] unable to find custom engagement type, ".concat(t.engagementType,". It must be registered with concierge before use.")),F.resolve({canShow:!1,code:0,reason:"Handler not registered with concierge."}))).then((function(t){return F.resolve(qs(e,t.canShow))}))},o.execute=function(e){var t=this;if(!t.isExecuting){t.isExecuting=!0;var n=va(this.parameters,"customChannel:"),i={engagementType:this.parameters.customChannelName,parameters:n},r=function(e){return{engagementStarted:function(){me.debug("[CustomActions] Concierge Code: concierge internal logic fired for engagement started",{parameters:e})},engagementEnded:function(){me.debug("[CustomActions] Concierge Code: concierge internal logic fired for engagement ended",{parameters:e})}}}(this.parameters);return function(e,t){var n=ma[e.engagementType];n?n.showEngagement(e,t):me.warn("[CustomActions] unable to find custom engagement type, ".concat(e.engagementType,". It must be registered with concierge before use."))}(i,r),F.resolve(null)}},o.destroy=function(e){so(e.wmState,o),this._openTimeout&&clearTimeout(this._openTimeout)},a}return n(r)}(Fs);function Ic(e){e.bridgeListener=_c.bind(e),window.addEventListener("message",e.bridgeListener,!1)}function _c(e,t){var n=xc,r=!1;null!=t&&(n=t.doPostMessage,r=!0);var a=this;window.test_concierge&&(a=window.test_concierge.widgetManager);var o,s=a.concierge,c=s.cacheManager,u=a.wmState;if("string"==typeof e.data&&"SessionCleared"!==e.data)try{o=JSON.parse(e.data)}catch(t){return me.log("WidgetBridge received invalid JSON: ",t),void me.log("Payload was:"+e.data)}else e.data.messageType&&(e.data.type=e.data.messageType),o=e.data;if(o&&o.call&&a.channelsWidget)a.channelsWidget.handleChannelsMessage(o,e);else{var l=o.widget;if(l){var d=a.engagementWidgets.widgets[l];if(d){var g=d.parameters;if(function(e,t){var n=window.location.hostname,i=(e.cacheManager.getClientCache("channelsHosts",!0)||[]).map((function(e){return Oc(e)})),r=Oc(e.scriptLocation),a=Oc(t.origin),o=[n,r].concat(i);if(!a||o.every((function(e){return a!==e}))){var s=['The domain "',document.domain,'" ','rejected message from un-trusted domain: "',a,'"'].join("");return e.isTestMode&&me.log(s),!1}return!0}(s,e)){var f,h=e.data,v=e.data.parameters;if(me.log("["+h.type+"] message accepted from: "+e.origin),!r&&"_multi"===h.type)return f=Tc(a,l,e,h,v),void n(e,f);f={};var p=null,m=null;switch(h.type){case"focusEvent":a.device===An&&"object"!==i(window.visualViewport)&&(a.makePositionAbsolute(),a.needsForceBlur=!0);break;case"getChatStore":null!=c.storagePlugin.get("MoxieChat",!0)?c.storagePlugin.get("MoxieChat",!0):c.storagePlugin.set("MoxieChat",{},!0),f={type:"getChatStoreResponse",replyForMsgId:h.msgId,parameters:{data:c.storagePlugin.get("MoxieChat",!0)}},n(e,f);break;case"blurEvent":a.device===An&&"object"!==i(window.visualViewport)&&(a.needsForceBlur=!1);break;case"resetConcierge":To(a,!0),a.removeWidget(d,!0),a.addWidget(d.parameters,d.parameters.rule);break;case"getVisitorProfile":p=Fn,f={type:"getVisitorProfileResponse",replyForMsgId:h.msgId,parameters:{data:c.getData(p)}},n(e,f);break;case"setVisitorProfile":p=Fn,c.setData(p,JSON.stringify(v.data));break;case"getEngagementRecord":m=c.getWidgetCache(l,Jn,!0),f={type:"getEngagementRecordResponse",replyForMsgId:h.msgId,parameters:{id:m,data:Po(c,m)}},n(e,f);break;case"onQuestionnaireSubmit":f={type:"onQuestionnaireSubmitResponse",replyForMsgId:h.msgId},s.onQuestionnaireSubmitCallbacks?s.onQuestionnaireSubmitCallbacks.doCallbacksAsync(rc.load(v.data)).then((function(t){f.parameters=t.toJson(),n(e,f)})):(f.parameters=JSON.stringify(v),n(e,f));break;case"getParameters":f={type:"getParametersResponse",replyForMsgId:h.msgId,parameters:{data:g}},n(e,f);break;case"setEngagementRecord":m=c.getWidgetCache(l,Jn,!0),Ro(c,m,v.data);break;case"createEngagementRecord":m=a.createEngagementRecord(d),c.setWidgetCache(l,Jn,m,!0),f={type:"createEngagementRecordResponse",replyForMsgId:h.msgId,parameters:{id:m,data:a.getEngagementRecord(m)}},n(e,f);break;case"getWidgetInitData":f={type:"getWidgetInitDataResponse",replyForMsgId:h.msgId,parameters:{data:{clientHref:window.location.href,parameters:d.parameters,configuration:d.configuration,translation:s.localization.data}}},n(e,f);break;case"getConfiguration":f={type:"getConfigurationResponse",replyForMsgId:h.msgId,parameters:{data:d.configuration}},n(e,f);break;case"getCache":f={type:"getCacheResponse",replyForMsgId:h.msgId,parameters:{key:v.key,value:c.getWidgetCache(l,v.key,v.persist)}},n(e,f);break;case"getCacheData":f={type:"getCacheDataResponse",replyForMsgId:h.msgId,parameters:{key:v.key,value:c.getData(v.key)}},n(e,f);break;case"getTranslation":f={type:"getTranslationResponse",replyForMsgId:h.msgId,parameters:{value:s.localization.data}},n(e,f);break;case"getOtherCache":f={type:"getOtherCacheResponse",replyForMsgId:h.msgId,parameters:{key:v.key,value:c.getWidgetCache(l,v.key,v.persist)}},n(e,f);break;case"getWidgetPath":var w=c.getWidgetCache("chat","widgetpath",!0);w||(w=c.getWidgetCache("kbot","widgetpath",!0)),f={type:"getWidgetPathResponse",replyForMsgId:h.msgId,parameters:{key:"widgetpath",value:w}},n(e,f);break;case"setCache":c.setWidgetCache(l,v.key,v.value,v.persist);break;case"setStoreCache":c.storagePlugin.set(v.key,v.value,!0);break;case"removeStoreCache":c.storagePlugin.del(v.key,v.persist),f={type:"removeStoreCacheResponse",replyForMsgId:h.msgId,parameters:{data:"clearedStore"}},n(e,f);break;case"removeCache":c.removeWidgetCache(l,v.key,v.persist);break;case"notificationMessage":if(Fa(u)||Va(u))return;v.title&&(v.title=s.getTranslation(Eo(l),v.title)),d.parameters.title=v.title,d.parameters.message=v.message,d.parameters.icon=v.icon,d.parameters.callToAction=v.callToAction,d.parameters.notificationType=2,d.notificationType=2,a.showNotification(d);break;case"updateWidgetTitle":a.updateWidgetTitle(l,v);break;case"updateTabText":on("#concierge .con_tab_text").text(v.text);break;case"hideWidget":d.hideWidget();break;case"setServiceLineId":a.setServiceLineId(v,l);break;case"setActive":v.active?co(u,d):uo(u,d);break;case"handleClose":c.setWidgetCache(l,"willHandleClose",v.value,!0);break;case"callFunction":f={type:"callFunctionResponse",replyForMsgId:h.msgId,parameters:{}},d[v.funcName]&&(f.parameters.result=d[v.funcName](v.funcArgs)),f.parameters&&f.parameters.result&&n(e,f);break;case"broadcast":a.handleBroadcast(l,v.eventType,v.data)}}}}}}function Oc(e){if(!e)return"";var t=e.match(/(https?:\/\/)([^/]+)/);return t?t[2]:""}var xc=function(e,t){e&&e.source&&e.source.postMessage(qo(t),e.origin)},Tc=function(e,t,n,i,r){var a=[],o=[],s={doPostMessage:function(e,t){a.push(t)}};return r.calls.forEach((function(i){i.parameters.signature=r.signature,i.parameters.widget=t,i.widget=t;var c=a.length,u=!1;try{e.bridgeListener({data:i,origin:n.origin},s)}catch(e){u=!0,a.push(null),o.push(e.name)}u||(o.push(null),a.length===c&&a.push(null))})),{type:"_multiResponse",replyForMsgId:i.msgId,parameters:{success:a,failure:o}}},Ac={exports:{}}; /*! * displacejs.js 1.3.2 - Tiny javascript library to create moveable DOM elements. * Copyright (c) 2019 Catalin Covic - https://github.com/catc/displace * License: MIT */ !function(e,t){e.exports=function(e){function t(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return e[i].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){function i(e){return e&&e.__esModule?e:{default:e}}var r=i(n(1));e.exports=r.default},function(e,t,n){function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(){var e=this,t=this.el,n=this.opts||c,i={};if(t.style.position="absolute",this.handle=n.handle||t,n.constrain){for(var r=n.relativeTo||t.parentNode,u=t,l=0,d=0;u!==r;)u=u.parentNode,(0,a.isRelative)(u)&&(l-=u.offsetLeft,d-=u.offsetTop),u===r&&(l+=u.offsetLeft,d+=u.offsetTop);var g=l+r.offsetWidth-t.offsetWidth,f=d+r.offsetHeight-t.offsetHeight;i.xClamp=(0,a.generateClamp)(l,g),i.yClamp=(0,a.generateClamp)(d,f)}this.opts=n,this.data=i,this.events={mousedown:o.mousedown.bind(this),mouseup:o.mouseup.bind(this),touchstart:o.touchstart.bind(this),touchstop:o.touchstop.bind(this),scrollFix:function(t){e.isDragging&&t.preventDefault()}},this.handleMove=s(this.opts.customMove),this.handle.addEventListener("mousedown",this.events.mousedown,!1),this.handle.addEventListener("touchstart",this.events.touchstart,!1),document.addEventListener("touchmove",this.events.scrollFix,{passive:!1})}Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n(3),s=(0,a.generateMoveFn)(),c={constrain:!1,relativeTo:null,handle:null,ignoreFn:null,highlightInputs:!1,onMouseDown:null,onMouseMove:null,onMouseUp:null,onTouchStart:null,onTouchMove:null,onTouchStop:null,customMove:null},u=function(){function e(t,n){if(i(this,e),!t)throw Error("Must include moveable element");this.el=t,this.opts=n,r.call(this)}return e.prototype.reinit=function(){this.destroy(),r.call(this)},e.prototype.destroy=function(){var e=this.events;this.handle.removeEventListener("mousedown",e.mousedown,!1),document.removeEventListener("mousemove",e.mousemove,!1),document.removeEventListener("mouseup",e.mouseup,!1),this.handle.removeEventListener("touchstart",e.touchstart,!1),document.removeEventListener("touchmove",e.touchmove,!1),document.removeEventListener("touchstop",e.touchstop,!1),document.removeEventListener("touchmove",this.events.scrollFix,{passive:!1})},e}();t.default=function(e,t){return new u(e,t)}},function(e,t){function n(e,t){return function(n){return Math.min(Math.max(n,e),t)}}function i(e){return"relative"===window.getComputedStyle(e).position}function r(){return window.requestAnimationFrame?function(e){var t=e||a;return function(e,n,i){window.requestAnimationFrame((function(){t(e,n,i)}))}}:function(e){return function(t,n,i){(e||a)(t,n,i)}}}function a(e,t,n){e.style.left=t+"px",e.style.top=n+"px"}Object.defineProperty(t,"__esModule",{value:!0}),t.generateClamp=n,t.isRelative=i,t.generateMoveFn=r},function(e,t){function n(e){var t=this.opts;if(t.highlightInputs){var n=e.target.tagName.toLowerCase();if("input"===n||"textarea"===n)return}if(!t.ignoreFn||!t.ignoreFn(e)){if(0===e.button){var r=this.el,a=this.events;"function"==typeof t.onMouseDown&&t.onMouseDown(r,e);var o=e.clientX-r.offsetLeft,s=e.clientY-r.offsetTop;a.mousemove=i.bind(this,o,s),document.addEventListener("mousemove",a.mousemove,!1),document.addEventListener("mouseup",a.mouseup,!1)}e.preventDefault()}}function i(e,t,n){var i=this.el,r=this.opts,a=this.data;"function"==typeof r.onMouseMove&&r.onMouseMove(i,n);var o=n.clientX-e,s=n.clientY-t;return r.constrain&&(o=a.xClamp(o),s=a.yClamp(s)),this.handleMove(i,o,s),n.preventDefault(),!1}function r(e){var t=this.el,n=this.opts,i=this.events;"function"==typeof n.onMouseUp&&n.onMouseUp(t,e),document.removeEventListener("mouseup",i.mouseup,!1),document.removeEventListener("mousemove",i.mousemove,!1)}function a(e){var t=this.opts;if(t.highlightInputs){var n=e.target.tagName.toLowerCase();if("input"===n||"textarea"===n)return}if(!t.ignoreFn||!t.ignoreFn(e)){var i=this.el,r=this.events;"function"==typeof t.onTouchStart&&t.onTouchStart(i,e);var a=e.targetTouches[0],s=a.clientX-i.offsetLeft,c=a.clientY-i.offsetTop;r.touchmove=o.bind(this,s,c),this.isDragging=!0,document.addEventListener("touchmove",r.touchmove,!1),document.addEventListener("touchend",r.touchstop,!1),document.addEventListener("touchcancel",r.touchstop,!1)}}function o(e,t,n){var i=this.el,r=this.opts,a=this.data;"function"==typeof r.onTouchMove&&r.onTouchMove(i,n);var o=n.targetTouches[0],s=o.clientX-e,c=o.clientY-t;return r.constrain&&(s=a.xClamp(s),c=a.yClamp(c)),this.handleMove(i,s,c),n.preventDefault(),!1}function s(e){this.isDragging=!1;var t=this.el,n=this.opts,i=this.events;"function"==typeof n.onTouchStop&&n.onTouchStop(t,e),document.removeEventListener("touchmove",i.touchmove,!1),document.removeEventListener("touchend",i.touchstop,!1),document.removeEventListener("touchcancel",i.touchstop,!1)}Object.defineProperty(t,"__esModule",{value:!0}),t.mousedown=n,t.mousemove=i,t.mouseup=r,t.touchstart=a,t.touchmove=o,t.touchstop=s}])}(Ac);var Dc=$(Ac.exports);function Nc(e){this.shouldDisplayBell=!1,this.KNOWN_WIDGETS={chat:{requires:["portalId","host"]},email:{requires:["mailboxId"]},kb:{requires:["articleLimit","portalId","searchText"]},kbot:{requires:["portalId","host"]},"cxone-expert":{requires:["siteId","searchText"]}},this.notificationType=0;var t=navigator;this.concierge=e,this.journeyViewManager=new Rs(e),this.stashedConciergeCss={top:"",bottom:""},this.needsForceBlur=!1,this.state="tab",this.device=Mn(t),this.openWidget=!1,this.widgetLoadPromises={},this.windowHasDragResize=!1,me.log("WidgetManager constructor: device="+this.device),this.device===Dn?this.widgetsType=new Ms(this):this.widgetsType=new Ns(this),this.bridgeListener={},this.initDraggableData()}function Mc(e){var t,n=e.concierge.cacheManager;return e.tabStyle=e.tabStyle||{verticalOffset:"100",verticalAnchor:1,horizontalOffset:"20",cascade:1},n&&e.engagementWidgets&&(t=e.engagementWidgets).conciergeTab&&t.conciergeTab.tabStyle&&(void 0!==t.conciergeTab.tabStyle.verticalOffset&&(e.tabStyle.verticalOffset=t.conciergeTab.tabStyle.verticalOffset),void 0!==t.conciergeTab.tabStyle.verticalAnchor&&(e.tabStyle.verticalAnchor=t.conciergeTab.tabStyle.verticalAnchor),void 0!==t.conciergeTab.tabStyle.horizontalOffset&&(e.tabStyle.horizontalOffset=t.conciergeTab.tabStyle.horizontalOffset),void 0!==t.conciergeTab.tabStyle.cascade&&(e.tabStyle.cascade=t.conciergeTab.tabStyle.cascade)),e.tabStyle}function Lc(e,t){var n,i,r,a,o,s=t.widget,c={},u=e.engagementWidgets.widgets[s].parameters;return"email"===s?(r="mailboxId",i="mailbox ID"):(r="portalId",i="portal ID"),u&&(o=u[r],n=u.host),(a=t[r]||o)||me.log("No Moxie "+i+" specified for engagement."),c[r]=a,ko(s)&&function(e,t,n){var i=e||t;i||me.log("No Moxie chat host specified for engagement.");n.host=i}(t.host,n,c),c}function Wc(e){window.MOXIE_CONCIERGE&&delete window.MOXIE_CONCIERGE.startEngagement,e.dataStartListener&&(Wt([document],"click",e.dataStartListener),delete e.dataStartListener),e.windowHasDragResize&&(Dt(window,"resize",e.dragResizeHandler.bind(this)),e.windowHasDragResize=!1),function(e){e.bridgeListener&&(window.removeEventListener("message",e.bridgeListener,!1),delete e.bridgeListener)}(e)}function Rc(e){e.initEngagementWidgets(),Ic(e),Mc(e),function(e){var t=e.widgetsType.html();t=t.replace(/\/DEVICE\//g,e.device);var n=!1;if(e.concierge.cacheManager&&e.engagementWidgets&&(n=e.engagementWidgets).conciergeTab&&n.conciergeTab.icon&&n.conciergeTab.icon.svg){var i=n.conciergeTab.icon.svg;t=t.replace(//g,i)}var r=on(t=$o(t)({concierge:e.concierge,CONCIERGE_TAB_ICON_SVG:e.engagementWidgets.conciergeTab.icon.svg,CON_CLOSED:Io(e)?" single-channel":"",CON_ROLE_ATTRIBUTE:Io(e)?"":' role="menu"',CLOSE_ICON:e.concierge.getTranslation("common","CLOSE_ICON"),CONCIERGE:e.concierge.getTranslation("common","CONCIERGE"),NOTIFICATION_ANNOUNCE:e.concierge.getTranslation("common","NOTIFICATION_ANNOUNCE")})),a=function(t){if("click"===t.type||13===t.which||32===t.which)return e.closeWidget(!1),!1};Lt(r,"click",Rt("con-close-area"),a),Lt(r,"keypress",Rt("con-close-area"),a);var o=Rt("con-widget-title-section");Lt(r,"keyup",o,(function(){return Xt(this,{outline:"-webkit-focus-ring-color auto 5px"}),!1})),Lt(r,"blur",o,(function(){return Xt(this,{outline:"none"}),!1}));var s=function(t){if("click"===t.type&&Xt(this,{outline:"none"}),"click"===t.type||13===t.which||32===t.which){var n=on(this).closest(".concierge-widget").data("widget");e.postMessageToWidget(n,"titleClicked");var i=e.engagementWidgets.widgets[n];return i.titleBar.onclick&&i.titleBar.onclick(e),!1}};Lt(r,"click",o,s),Lt(r,"keypress",o,s),e.widgetsType.beforeAppend&&e.widgetsType.beforeAppend(r),on("body").append(r[0]),r.hide()}(e);var t=on("#concierge .con-icon svg");void 0!==t&&t.length>0&&xo(t[0]),e.$concierge=on("#concierge"),e.widgetsType.start()}Nc.prototype.startExternal=function(e,t){var n=this,i=!0===t.enableChatDeflection||"true"===t.enableChatDeflection;null!==t.widget&&void 0!==t.widget||(t.widget=t.startEngagement),"chat"===t.widget&&i&&(t.widget="kbot");var r=[];"kbot"===t.widget||"chat"===t.widget?(r.push("kbot"),r.push("chat")):r.push(t.widget);var a,o=null;if(r.forEach((function(e){if(null===o){var t=function(e,t){var n=!1;return Object.keys(e.spots).forEach((function(i){var r=e.spots[i];r.widget&&r.widget.name===t&&(n=r.twiddled)})),n}(n.wmState,e);t&&(o=e)}})),null!==o){var s=F.resolve(null);return me.log('WidgetManager.startExternal not starting widget "'+t.widget+'" because the spot is twiddled'),(null!==(a=this.wmState).open&&void 0!==a.open?a.open.name:null)!==o&&(me.log('WidgetManager.startExternal is showing existing widget "'+o+'"'),"tab"===this.state&&this.widgetsType.openWidgetMenu&&(s=s.then((function(){return n.widgetsType.openWidgetMenu()}))),s=s.then((function(){return n.showWidget(n.findWidget(o))}))),s.then((function(){return{status:!1}}))}delete t.startEngagement,delete t.enableChatDeflection,t.ruleSource=e;var c=[Yn,Qn];if(t.ruleId=-1*(1+c.indexOf(e)),t.action="success",null===t.widget||void 0===t.widget||""===t.widget)return me.log("WidgetManager.startExternal invoked with improper widget specification"),F.resolve({status:!1,invalid:!0});var u=this;wn(t,Lc(this,t));var l=null;l="kbot"===t.widget?["kbot","chat"]:"chat"===t.widget?["chat","kbot"]:[t.widget];var d=F.resolve(null);return l.forEach((function(e){var t=n.findWidget(e);null!=t&&(me.log('WidgetManager.startExternal Removing widget: "'+e+'"'),d=d.then((function(){return u.removeWidget(t,!0)})))})),d.then((function(){return function(e,t){var n={name:t.ruleName,source:t.ruleSource,id:t.ruleId,action:t.action},i=F.resolve();return i.then((function(){if(e.notificationDisplayed())return me.log("WidgetManager.displayWidget("+t.widget+":"+t.ruleName+"): is closing the notification"),to(e.wmState)})).then((function(){return e.addWidget(t,n)})).then((function(n){if(n&&void 0!==n.status&&!1===n.status)return me.log("WidgetManager.displayWidget("+t.widget+":"+t.ruleName+"): halted because addWidget failed"),n;var i=F.resolve(null);return!1!==e.openWidget&&e.openWidget!==t.widget&&(i=i.then((function(){return e.hideWidget(!0)}))),i.then((function(){return e.showWidget(n.ref)})).then((function(){return e.showConcierge()})).then((function(){return e.widgetsType.openConcierge()})).then((function(){return{ref:n.ref,status:!0}}))})).catch((function(e){return me.log("WidgetManager.displayWidget("+t.widget+":"+t.ruleName+"): failed: "+e),me.log(e.stack),bo}))}(n,t)}))},Nc.prototype.findWidget=function(e){for(var t in this.wmState.spots){var n=this.wmState.spots[t];if(n.widget&&n.widget.name===e)return n.widget;if(n.reactive&&n.reactive.name===e)return n.reactive}return this.wmState.offer&&this.wmState.offer.name===e?this.wmState.offer:this.engagementWidgets.widgets[e]},Nc.prototype.initDraggableData=function(){this.widgetAreaDragData||(this.widgetAreaDragData={draggedByUser:!1,initialElemData:null,currentElemData:null,parentData:null,resizedWhileMinimized:!1})},Nc.prototype.removeDraggableData=function(){delete this.widgetAreaDragData},Nc.prototype.dragStartHandler=function(e,t){this.$concierge.find("#concierge-iframe-cover").show(),Oe(e,"is-dragging"),this.widgetAreaDragData.currentElemData=e.getBoundingClientRect(),this.widgetAreaDragData.parentData=e.parentNode.getBoundingClientRect(),this.widgetAreaDragData.draggedByUser||(on(e).addClass(So),this.widgetAreaDragData.initialElemData=this.widgetAreaDragData.currentElemData,this.widgetAreaDragData.draggedByUser=!0)},Nc.prototype.dragMaxCalculations=function(){var e,t=document.body.getBoundingClientRect().width-this.widgetAreaDragData.parentData.left,n=0-(this.widgetAreaDragData.currentElemData.width-t),i=this.widgetAreaDragData.parentData.right-this.widgetAreaDragData.initialElemData.right-this.widgetAreaDragData.parentData.width,r=this.widgetAreaDragData.currentElemData.width+i,a=0-r;this.widgetAreaDragData.parentData.left>r&&(a=0-this.widgetAreaDragData.parentData.left);var o=window.visualViewport?window.visualViewport.height:window.innerHeight;if(1===this.tabStyle.verticalAnchor){var s=o-this.widgetAreaDragData.parentData.top;e=0-this.widgetAreaDragData.currentElemData.height+s}else e=o-this.widgetAreaDragData.currentElemData.height-this.widgetAreaDragData.initialElemData.top;return{minX:a,maxX:n,minY:0-this.widgetAreaDragData.parentData.top,maxY:e}},Nc.prototype.dragMoveHandler=function(e,t,n){if(this.widgetAreaDragData.currentElemData){var i=this.dragMaxCalculations(),r=i.minX,a=i.maxX,o=i.minY,s=i.maxY;t=Math.min(t,a),t=Math.max(t,r),n=Math.min(n,s),n=Math.max(n,o)}this.widgetAreaDragData.x=t,this.widgetAreaDragData.y=n,Xt(e,{left:this.widgetAreaDragData.x,top:this.widgetAreaDragData.y})},Nc.prototype.dragConfigData=function(){return{moveableWidgets:this.engagementWidgets.globalSettings.moveableWidgets,tabStyle:this.tabStyle}},Nc.prototype.isDragConfigDataEqualToCurrent=function(e){if("object"!==i(e))return!1;var t=this.dragConfigData();if(e.moveableWidgets!==t.moveableWidgets||"object"!==i(e.tabStyle)||"object"!==i(t.tabStyle))return!1;for(var n=["cascade","horizontalOffset","verticalAnchor","verticalOffset"],r=0;r')}o.attr("title",a)}var u=n.find(".concierge-widget-header .con-widget-title-section");t.hasCallback?u.addClass("clickable-title").addClass(".clickable-title"):u.removeClass("clickable-title").removeClass(".clickable-title")},Nc.prototype.makePositionAbsolute=function(){var e;"absolute"!==this.$concierge.css("position")&&(this.stashedConciergeCss=this.$concierge.css(["top","bottom"]),e=this.$concierge.offset().top,this.$concierge.css({position:"absolute",top:e,bottom:""}))},Nc.prototype.makePositionFixed=function(){var e,t;"fixed"!==this.$concierge.css("position")&&this.stashedConciergeCss&&(t="auto"!==this.stashedConciergeCss.top?"top":"bottom",e=this.$concierge.offset().top-document.body.scrollTop,this.$concierge.css({position:"fixed",top:e,bottom:"auto"}),"top"===t?ee(this.$concierge,ns,{top:this.stashedConciergeCss.top},{label:"makePositionFixedTop"}):ee(this.$concierge,ns,{top:gt()-parseInt(this.stashedConciergeCss.bottom,10)-this.$concierge.height()},{label:"makePositionFixedBottom",done:function(){this.$concierge.css({top:"auto",bottom:this.stashedConciergeCss.bottom})}.bind(this)}))},Nc.prototype.handleGetTabInfo=function(e,t){var n=this.concierge.cacheManager.getWidgetCache(t,"cookieId",!0);n||(n=Math.ceil(1e5*Math.random()),this.concierge.cacheManager.setWidgetCache(t,"cookieId",n,!0)),e.source.postMessage(JSON.stringify(qo({origWindowName:window.name,cookieID:n,currentOrigin:window.location.protocol+window.location.host,previousOrigin:window.location.protocol+window.location.host,sessionId:this.concierge.cacheManager.getWidgetCache(t,"sessionId")})),e.origin)},Nc.prototype.handleSetChatInProgress=function(e,t,n){var i=this.engagementWidgets.widgets[t];i&&void 0!==i.sendSearchGuid&&i.sendSearchGuid(e,n),this.concierge.cacheManager.setWidgetCache(t,"sessionId",Math.abs(parseInt(e))),e>0?this.markChat(e,"start"):e<0&&this.markChat(e,"end")},Nc.prototype.setNotificationType=function(e){return e>=0&&e<=2&&(this.notificationType=e,!0)},Nc.prototype.handleBroadcast=function(e,t,n){if(this[e+"HandleBroadcast"]&&this[e+"HandleBroadcast"](e,t,n))return F.resolve(!0);var i=this,r=this.engagementWidgets.widgets[e],a="widget:"+Eo(e)+":"+t;return(r&&r.updateBroadcastPayload?r.updateBroadcastPayload(a,n):F.resolve(n)).then((function(t){if(function(e,t,n,i){try{switch(n){case"widget:chat:agentJoinedSession":xi(e.concierge,!0,t,i.agentId,i.agentName,i.sessionId,i.serviceLine,i.serviceLineId,i.currentServiceLineId);break;case"widget:chat:agentLeftSession":i.agentId&&xi(e.concierge,!1,t,i.agentId,i.agentName,i.sessionId,i.serviceLine,i.serviceLineId);break;case"widget:chat:chatSessionActive":Ti(e.concierge,i.sessionId,i.chatState,t);break;case"widget:chat:chatSessionSuspend":Ai(e.concierge,i.sessionId,t);break;case"widget:chat:chatSessionResume":Di(e.concierge,i.sessionId,t);break;case"widget:chat:articleViewed":case"widget:kb:articleViewed":case"widget:cxone-expert:articleViewed":Mi(e.concierge,t,i.articleId,i.articleTitle);break;case"widget:chat:articleRated":case"widget:kb:articleRated":case"widget:cxone-expert:articleRated":Li(e.concierge,t,i.articleId,i.articleTitle,i.search,i.ratingType,i.rating);break;case"widget:chat:articleCommented":case"widget:kb:articleCommented":case"widget:cxone-expert:articleCommented":Wi(e.concierge,t,i.articleId,i.articleTitle,i.search,i.ratingType,i.rating,i.comment);break;case"widget:chat:chatSessionStarted":Ni(e.concierge,!0,t,i.sessionId,i.serviceLine,i.serviceLineId);break;case"widget:chat:chatSessionEnded":Ni(e.concierge,!1,t,i.sessionId,i.serviceLine,i.serviceLineId),function(e,t){var n=t.sessionId;n&&e.concierge.cacheManager.setWidgetCache("kbot","lastChatSessionEnded",n,!1)}(e,i);break;case"widget:email:emailSent":Ri(e.concierge,t,i.mailboxId);break;case"widget:kb:portalSearched":case"widget:cxone-expert:portalSearched":case"widget:chat:portalSearched":Bi(e.concierge,t,i.searchText,i.portalId,i.articlesList);break;case"widget:chat:prechatQuestionnaireComplete":Hi(e.concierge,t,i.serviceLine,i.serviceLineId)}}catch(e){me.log("Error in processBroadcast"+e)}}(i,e,a,t),"widget:chat:agentJoinedSession"===a)t.device=i.concierge.contextMonitor.getLastDevice(),t.type=i.concierge.widgetManager.engagementWidgets.widgets[e].proactive?"PROACTIVE":"REACTIVE",tr(a,t);else tr(a,t);return null})).catch((function(e){me.log("handleBroadcast Error:"+e)}))},Nc.prototype.markChat=function(e,t){var n=this.concierge.cacheManager.getData(Fn),i=this.journeyViewManager.markChat(n,e,t);this.concierge.cacheManager.setData(Fn,JSON.stringify(i))},Nc.prototype.showNotification=function(e){me.log("WidgetManager.showNotification called:",e.name),this.wmState.notification!==e&&to(this.wmState),this.wmState.notification=e,function(e,t){var n=t.parameters,i=n.title,r=n.message,a=n.icon,o=n.callToAction,s=e.widgetsType.getNotification();s.attr("data-spot",t.spot),s.attr("data-widget",t.name),s.find(".concierge-notification-title").text(i||""),s.find(".con-notification-body").html(Ao(r));var c=s.find(".con-notification-calltoaction");o&&o.length?(c.show(),c.html(Ao(o)),c.attr("tabindex","0")):(c.hide(),c.attr("tabindex","-1"));var u=s.find(".con-notification-icon"),l="";if(a){u.show();var d=e.concierge.scriptLocation+"";Ce(d,"/")||(d+="/"),l=''}else u.hide();u.html(l)}(this,e),this.widgetsType.displayNotification(e,e.engagementId),this.setNotificationType(e.notificationType);var t,n,i=Eo(e.name);tr("notification",{engagementId:e.engagementId,notificationType:Do(e.notificationType),widgetName:i,status:"displayed",rule:e.parameters.rule}),1===e.notificationType&&"None"!==e.parameters.offer_type&&(t=this.concierge,n=Date.now(),t.cacheManager.setClientCache("lastNotified",n),tr("proactiveOffer",{widgetName:i,status:"displayed",rule:e.parameters.rule,device:this.concierge.contextMonitor.getLastDevice()}))},Nc.prototype.notificationDisplayed=function(){return qa(this.wmState)},Nc.prototype.broadcastCloseProactiveNotification=function(e,t){var n=e.parameters;tr("proactiveOffer",{widgetName:n.widget,status:t,rule:n.rule,device:this.concierge.contextMonitor.getLastDevice()}),"accepted"===t?Vi(this.concierge,n.widget,n.rule):"declined"===t&&qi(this.concierge,n.widget,n.rule)},Nc.prototype.postMessageToWidget=function(e,t,n){var r,a,o=this,s=this.engagementWidgets.widgets[e],c=this.concierge.cacheManager.getWidgetCache(e,"active_session");"willClose"!==t&&"willTerminate"!==t||uo(this.wmState,s),c&&s.remoteURL&&n?(a=ko(e)&&"object"===i(s.remoteURL)?s.remoteURL[s.portalId]:s.remoteURL,r=a.match(/^https?:\/\/[^/]+/)[0]):r="*";var u=this.widgetAreaIFrameForWidget(e);if(u.length){var l=u[0].contentWindow,d={widget:e,type:t,parameters:n},g=function(){l.postMessage(qo(d),r),me.log(d.type+" message posted to : "+r),"willTerminate"===t&&o.handleBroadcast(e,"widgetTerminated",{})},f=u.data("loadPromise");return f?f.then(g):rr(g)}return"willTerminate"===t&&o.handleBroadcast(e,"widgetTerminated",{}),F.resolve()},Nc.prototype.callWidgetFunction=function(e,t,n){var r,a,o=this.engagementWidgets.widgets[e];o.remoteURL?(a=ko(e)&&"object"===i(o.remoteURL)?o.remoteURL[o.portalId]:o.remoteURL,r=a.match(/^https?:\/\/[^/]+/)[0]):r="*";var s=this.widgetAreaIFrameForWidget(e),c=s[0].contentWindow,u={widget:e,type:"functionCall",parameters:{functionName:t,functionData:n}},l=function(){c.postMessage(qo(u),r),me.log(u.type+" message posted to : "+r)};return s.data("loaded")?F.resolve(l()):(s.data("loadPromise")||F.resolve()).then(l)},Nc.prototype.writeSrcToIframe=function(e){if(e!=ni){var t=this.widgetAreaIFrameForWidget(e);if(t.length>0){var n=this.concierge.scriptLocationWithBrand+"/widgets/"+e+"/"+this.concierge.assetVersion.widgets+"/index.html";t.attr("src",n)}}},Nc.prototype.widgetAreaForWidget=function(e){return this.$concierge.find("#concierge-widget-"+e)},Nc.prototype.widgetAreaIFrameForWidget=function(e){return this.widgetAreaForWidget(e).find("iframe")},Nc.prototype.loadWidget=function(e){var t=e.name,n=e.parameters,i=e.engagementId;if(me.log('WidgetManager.loadWidget("'+t+'", "'+JSON.stringify(n)+'", '+i+'"): invoked.'),!this._disabled){var r=i;if(!e.state){n.rule.source!==Qn&&(e.widgetParameters=n);var a=on("#concierge-widget-area");if(0===this.widgetAreaForWidget(t).length){var o={widget:e,widgetName:t,CLOSE_ICON:this.concierge.getTranslation("common","CLOSE_ICON"),FOOTER:this.concierge.getTranslation("common","FOOTER")},s="";this.engagementWidgets.globalSettings&&!this.engagementWidgets.globalSettings.hideMoxieBranding&&(s=$o('')(o)),o.moxieBranding=s;var c=t==ni?$o("
    ")(o):$o('
    \n
    \n
    \n
    \n

    <%= widget.title %>

    \n
    \n
    \n \n
    \n
    \n\n
    \n \n \n <%= moxieBranding %>\n
    \n')(o);c=c.replace(/\/SCRIPT_LOCATION\//g,this.concierge.scriptLocation+"/"),a.append(c)}void 0===i&&(i=this.createEngagementRecord(e),r=i),e.state=2,e.proactive=n&&n.proactive||!1,me.log("WidgetManager.loadWidget("+t+"): set widget.proactive="+e.proactive),e.beforeLoad();var u=this,l=this.concierge.cacheManager.getWidgetCache(t,"active_session");if(l||e.shouldReplaceIframeSrc){var d=this.widgetAreaIFrameForWidget(t),g=e.getRemoteURL();me.log("WidgetManager.loadWidget("+t+"): requests iframe src="+g,"hasActive:",l,"shouldReplace:",e.shouldReplaceIframeSrc),d.data("loadPromise",i=new F((function(e){d.attr("src",g),d.on("load",(function(){d.data("loaded")||(d.data("loaded",!0),e(r))}))})))}else void 0!==e.prepareToLoadPromise?e.prepareToLoadPromise.then((function(){u.writeSrcToIframe(t)})):this.writeSrcToIframe(t);this.updateWidgetTitle(t,{text:e.titleBar&&e.titleBar.text?"title":"",graphic:e.titleBar&&e.titleBar.graphic?e.titleBar.graphic:null})}var f=this.concierge.getTranslation(t,"title","Concierge");return this.widgetAreaIFrameForWidget(t).attr("title",f),i}},Nc.prototype.replaceWidget=function(e){var t=this,n={status:!0,ref:e,parameters:e.parameters,ruleSettings:this.concierge.rulesEngine.getSiteSettings(),engagementId:e.engagementId};return e.beforeAdd(n).then((function(n){return n&&n.status&&Ja(t.wmState,e,!0),n}))},Nc.prototype.getSeenChannelsHosts=function(){return this.seenChannelsHosts||(this.seenChannelsHosts=this.concierge.cacheManager.getClientCache("channelsHosts",!0)||[]),this.seenChannelsHosts},Nc.prototype.registerChatHost=function(e){var t=this.getSeenChannelsHosts();te(t,e)<0&&(t.push(e),this.seenChannelsHosts=t,this.concierge.cacheManager.setClientCache("channelsHosts",t,!0))},Nc.prototype.showWidget=function(e){var t=e.name,n=e.parameters,i=e.engagementId,r=this.wmState;me.log("WidgetManager.showWidget("+t+", "+JSON.stringify(e.parameters)+", "+i+"): invoked.");var a=F.resolve();if(e){var o=this,s=on("#concierge-widget-area");ko(t)&&n.host&&this.registerChatHost(n.host),a=a.then((function(){return e.spot&&_o(r,e)?o.replaceWidget(e):"function"==typeof e.shouldRebuildIframe&&e.shouldRebuildIframe()?(o.widgetAreaIFrameForWidget(t).replaceWith(''),rr((function(){o.writeSrcToIframe(t)})).then((function(){return o.concierge.cacheManager.removeWidgetCache(t,"rebuildIframe",!1)}))):void 0})).then((function(){e.proactive=n&&n.proactive||!1,me.log("WidgetManager.showWidget("+e.label()+"): set widget.proactive="+e.proactive)})).then((function(){return e.state?F.resolve(o.postMessageToWidget(t,"willShow",n)).then((function(){return o.concierge.cacheManager.getWidgetCache(t,Jn,!0)})):o.loadWidget(e)})).then((function(n){return n&&null!==o.getEngagementRecord(n)||(n=o.createEngagementRecord(e)),e.engagementId=i=n,o.concierge.cacheManager.setWidgetCache(t,Jn,i,!0)})).then((function(){var e,n=o.getEngagementRecord(i);if(ko(t)){if(null===n)me.log('WidgetManager.showWidget("'+i+'"): was null.');else if(n.proactive&&void 0===n.chat.time_to_decide){var r=new Date(n.time).getTime();n.chat.time_to_decide=Math.round(((new Date).getTime()-r)/1e3),n.chat.missed_reason=0,n.decision_type="Accepted",e=o.setEngagementRecord(i,n)}}else null!==n&&n.proactive&&(n.decision_type="Accepted",e=o.setEngagementRecord(i,n));return e||(e=F.resolve()),e.then((function(){return o.concierge.contextMonitor.recordEngagementValue()}))})).then((function(){if(o.notificationDisplayed())return me.log("WidgetManager.showWidget("+e.label()+"): ignoring the notification"),to(r)})).then((function(){return s.addClass("con-open"),o.$concierge.addClass("con-open-widget"),r.open=e,za(o.wmState,e.spot),e.name!=ni&&"undefined"!=typeof brandembassy&&brandembassy("hideChatWindow"),o.openWidget!==t?(o.widgetsType.openWidget(e),tr("widgetOpened",{widgetName:t,source:n.rule.source}),o.openWidget=t):o.widgetsType.makeWidgetActive(o.widgetAreaForWidget(t)),null}))}return a},Nc.prototype.forceBlur=function(){if(this.needsForceBlur){on("#concierge").append('');var e=on("#fakefocus");e.focus(),e.blur(),e.remove(),this.needsForceBlur=!1}},Nc.prototype.hideWidget=function(e){var t=this,n=t.postMessageToWidget(t.openWidget,"willHide");return e||(n=n.then((function(){return To(t,!1)}))),"undefined"!=typeof brandembassy&&brandembassy("hideChatWindow"),n},Nc.prototype.closeWidget=function(e){var t=this,n=t.postMessageToWidget(t.openWidget,"willClose"),i=this.wmState.open;return e||t.concierge.cacheManager.getWidgetCache(t.openWidget,"willHandleClose",!0)||(n=n.then((function(){return To(t,!0)})).then((function(){i&&i.closeWidget()}))),n},Nc.prototype.fixPosition=function(e){this.widgetsType.fixPosition&&this.widgetsType.fixPosition(e,this.$concierge)},Nc.prototype.expandConcierge=function(){me.log("WidgetManager.expandConcierge(): invoked.")},Nc.prototype.collapseConcierge=function(){me.log("WidgetManager.collapseConcierge(): invoked.")},Nc.prototype.preloadCSS=function(){return Mc(this),function(e){var t="concierge-style-"+e.widgetsType.cssType;return 0===on("#"+t).length?new F((function(n){var i=e.concierge.scriptLocationWithBrand+"/widgets/"+e.concierge.assetVersion.widgets+"/"+e.widgetsType.cssType+".css",r=document.getElementsByTagName("head")[0],a=document.createElement("link");a.onload=function(){n(!0)},a.id=t,a.rel="stylesheet",a.type="text/css",a.href=i,a.media="all",r.appendChild(a)})):F.resolve(!0)}(this)},Nc.prototype.init=function(){me.log("WidgetManager.init(): invoked."),this.$concierge=on("#concierge"),0===this.$concierge.length&&Rc(this)},Nc.prototype.showConcierge=function(){me.log("WidgetManager.showConcierge(): invoked."),on("#concierge-widgets ul li").length>0&&on("#concierge").show()},Nc.prototype.hideConcierge=function(){me.log("WidgetManager.hideConcierge(): invoked."),on("#concierge").hide()},Nc.prototype.getWidgetPath=function(){return this.concierge.cacheManager.getWidgetCache("chat","widgetpath",!0)||this.concierge.cacheManager.getWidgetCache("kbot","widgetpath",!0)},Nc.prototype.setServiceLineId=function(e,t){var n=this;if(t&&t.parameters){var i=t.name,r=t.parameters;r.serviceLineId!==e.serviceLineId&&(r.serviceLineId=e.serviceLineId,this.concierge.serviceLines.getName(e.serviceLineId).then((function(i){return r.serviceLine=i,r.serviceLineId=e.serviceLineId,r.parameters&&r.parameters.queue&&(r.parameters.queue=e.serviceLineId),co(n.wmState,t),null})).catch((function(t){me.log('setServiceLineId("'+i+'", '+JSON.stringify(e)+"): ERROR: "+t)})))}},Nc.prototype.loadActiveWidgets=function(){var e=this,t=e.wmState.wm.concierge.cacheManager.getClientCache("activeWidgets")||[],n=null,i=[];e.loadingActiveWidgets=!0;for(var r=0;r1?n-1:0),r=1;r1?n-1:0),r=1;r1?n-1:0),r=1;r1?n-1:0),r=1;r1?n-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:1;return e},eventService:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:cu,t=arguments.length>1?arguments[1]:void 0,n=Xc("prevState",e),i=JSON.parse(JSON.stringify(n));if(!e.terminating)switch(t.type){case Zc:return wn(n,{prevState:i},{events:[].concat(G(e.events),[Xc("type",t)]),eventsCount:e.eventsCount+1});case eu:return wn(n,{prevState:i},{events:[].concat(G(e.events),[Xc("type",t)]),eventsCount:e.eventsCount+1,priorityEventAdded:!0})}switch(t.type){case tu:return wn(n,{prevState:i},{events:[],eventsCount:0,sending:e.events});case nu:return wn(n,{prevState:i},{events:[],eventsCount:0,sending:e.events,priorityEventAdded:!1});case iu:return wn(n,{prevState:i},{sending:[],lastServerCallOK:!0,failureStreak:0});case ru:return wn(n,{prevState:i},{events:[].concat(G(e.sending),G(e.events)),eventsCount:e.eventsCount+e.sending.length,sending:[],lastServerCallOK:!1,failureStreak:e.failureStreak+1});case au:var r=t.value||!1;return wn(n,{prevState:i},{batchTimerState:r});case ou:return wn(n,{prevState:i},{terminating:!0})}return e}});function lu(e,t,n){var i=3e4;return n>0&&(i+=1333*Math.pow(n,2),i=Math.min(3e5,i)),new F((function(n,r){var a=new XMLHttpRequest;a.open("POST",t.serverEndpoint),a.timeout=i,a.setRequestHeader("Content-Type","application/json"),a.setRequestHeader("Accept","application/json"),a.onload=function(e){return n({status:a.status,body:a.response})},a.onerror=function(e){return n({status:a.status,message:"Could not read error response, probably because CORS headers are missing."})},a.send(JSON.stringify(function(e){for(var t={e:[]},n={},i=JSON.parse(JSON.stringify(e)),r=0;r=a)return-1;if(i<0&&(i=Math.max(a+i,0)),void 0===t){do{if(i in r&&void 0===r[i])return i}while(++i0){n({type:e});var r=i().eventService.failureStreak;lu(i().eventService.sending,t,r).then((function(t){t&&!i().eventService.terminating&&(t.status>=200&&t.status<300||t.status>=400&&t.status<500?(fu(e,!0),n(pu())):r>=8640?(fu(e,!1),n(pu())):(fu(e,!1),n({type:ru})))}))}}};function vu(e){return hu(tu,e)}function pu(){return{type:iu}}var mu="INITIALIZED",wu="RUNNING",yu="CANCELLED",bu="EXPIRED",Su=function(){function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e){return e};e(this,t),this.timeout_in_ms=n,this.stateChangeCallbackFn=i,this.timerState=mu}return n(t,[{key:"timerInternalState",value:function(){return this.timerState}},{key:"startTimer",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.timeout_in_ms,n=function(){e.timerState=bu,e.stateChangeCallbackFn(bu)};this.timer=setTimeout(n,t),this.timerState=wu,this.stateChangeCallbackFn(wu)}},{key:"cancelTimer",value:function(){clearTimeout(this.timer),this.timerState=yu,this.stateChangeCallbackFn(yu)}}]),t}(),Cu=[function(e){var t={schemaVersion:1,eventService:wn({},e.eventService,{terminating:!1})};return wn({},e,t)}],ku=function(e){var t=e.serverEndpoint.indexOf("-")+1,n=e.serverEndpoint.indexOf(".")-t;return e.serverEndpoint.substr(t,n)},Eu=function(e){return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Cu,n=e.schemaVersion||0,i=t.length;if(nt})),e}(JSON.parse(e)))},Iu=function(e){var t,n,i="moxie_"+ku(e)+"EventState";try{var r=localStorage.getItem(i);return null===r?(t=i,n=localStorage.getItem("moxieState"),localStorage.removeItem("moxieState"),localStorage.setItem(t,n),null!=(r=n)?Eu(r):void 0):Eu(r)}catch(e){return}};function _u(e,t,n){e.subscribe((function(){var i=e.getState().eventService.prevState.eventsCount,r=e.getState().eventService.eventsCount;if(i!==r){var a=e.getState().eventService.prevState.lastServerCallOK,o=e.getState().eventService.lastServerCallOK,s=e.getState().eventService.priorityEventAdded,c=0===e.getState().eventService.sending.length;c&&s?(t.cancelTimer(),e.dispatch(function(e){return hu(nu,e)}(n))):c&&o&&r>=5?(t.cancelTimer(),e.dispatch(vu(n))):0===i&&r>=1?(t.cancelTimer(),o?t.startTimer():t.startTimer(1e4)):!0===a&&!1===o&&(t.cancelTimer(),t.startTimer(1e4))}})),e.subscribe((function(){var t=e.getState().eventService.prevState.batchTimerState,i=e.getState().eventService.batchTimerState;t!==i&&"EXPIRED"===i&&e.dispatch(vu(n))})),e.subscribe((function(){var t=e.getState().eventService.prevState.eventsCount,i=e.getState().eventService.eventsCount,r=e.getState().eventService.prevState.sending,a=e.getState().eventService.sending,o=e.getState().eventService.terminating;(t!==i||r!==a)&&!o&&function(e,t){var n="moxie_"+ku(t)+"EventState";try{var i=JSON.stringify(e);localStorage.setItem(n,i)}catch(e){return}}(e.getState(),n)}))}var Ou=function(){function t(n){if(e(this,t),this.store=null,this.batchTimer=null,this.config=n,this.startEventService(),void 0===this.config.serverEndpoint)throw"serverEndpoint config value is required for the EventService"}return n(t,[{key:"notifyEventService",value:function(e){this.store.dispatch({type:Zc,payload:e})}},{key:"notifyEventServiceImmediately",value:function(e){this.store.dispatch({type:eu,payload:e})}},{key:"startEventService",value:function(){var e=Iu(this.config);null!=e&&null!==e.eventService&&void 0!==e.eventService&&(e.eventService.failureStreak=0),this.store=Bc(uu,e,function(){for(var e=arguments.length,t=new Array(e),n=0;n2&&void 0!==arguments[2]?arguments[2]:{};on("#concierge").remove(),this.url=e,this.pageTitle=t,this.scriptLocation=this.scriptElement.getScriptLocation(),this.brandId=this.scriptElement.getBrandId(),this.brandPrefix=this.brandId?"/brands/".concat(this.brandId):"",this.scriptLocationWithBrand=this.scriptLocation+this.brandPrefix,this.isTestMode=this.scriptElement.getTestMode(),this.logDisabled=this.scriptElement.getLogFlag(),this.clientName=this.scriptElement.getClientName(),this.positionMethod=this.scriptElement.getDisplayConfiguration().positionMethod,this.conciergeHost=this.scriptElement.getConciergeHost(),this.separator=this.scriptElement.getConciergeSeparator(),this.protocol=0===this.scriptLocation.indexOf("https:")?"https:":"http:",this.currentOfferCreatedAt=null,this.gomoxie=this.registerNamespace(),this.loadState=xu,this.serviceUrl={connector:this.protocol+"//connector"+this.separator+this.clientName+"."+this.conciergeHost,location:this.protocol+"//location."+this.conciergeHost,events:this.protocol+"//events"+this.separator+this.clientName+"."+this.conciergeHost+"/1.1/events"},this.assetVersion={rules:0,widgets:0},this.onQuestionnaireLoadedCallbacks=new ca,this.onQuestionnaireSubmitCallbacks=new ca,this.httpGet=this.httpGet||(new En).get,this.httpGetXMLHttpRequest=this.httpGetXMLHttpRequest||(new En).getXMLHttpRequest,this.localization=n.localization||new oa(this),this.rulesEngine=n.rulesEngine||new ka(this),this.eventService=n.eventService||new Ou({serverEndpoint:this.serviceUrl.events}),this.publicAPI=n.publicAPI||new Vo,this.publicAPI.registerMethods(this,this.gomoxie),this.publicApiV2=n.publicApiV2||new Fo(this,this.gomoxie),this.cacheManager=this.cacheManager||n.cacheManager||new zr(this),this.widgetManager=n.widgetManager||new Nc(this),this.contextMonitor=n.contextMonitor||new aa(this),this.serviceLines=n.serviceLines||new ua(this)}},{key:"prepareAndInit",value:function(e,t,n){return this.prepare(e,t,n),this.init()}},{key:"initAPI",value:function(){var e=this,t="config/latest/".concat("2","/web/configuration.json");-1!==this.url.indexOf("MoxieTest=true")&&sessionStorage.setItem("MoxieConfigCacheBust","true"),"true"===sessionStorage.getItem("MoxieConfigCacheBust")&&(t+="?cacheBuster="+Date.now());var n=this.httpGet("".concat(e.scriptLocationWithBrand,"/").concat(t)).catch((function(n){if(""===e.brandPrefix)throw console.error("Concierge could not load configuration.json"),n;return e.scriptLocationWithBrand=e.scriptLocation,e.brandPrefix="",e.brandId=0,console.error("Concierge could not load configuration.json for brand. Retrying with default"),e.httpGet("".concat(e.scriptLocation,"/").concat(t))}));return this.apiReady=F.all([n.then((function(t){return e.configuration=t,e.assetVersion.widgets=t.widgets.version,e.localization.init(),e.widgetManager.preloadCSS()})),e.cacheManager.init()]).then((function(){return e.contextMonitor.initTracking()})).then((function(){return e.widgetManager.init(),e.rulesEngine.init(e.configuration),e.widgetManager.loadActiveWidgets()})).then((function(){return function(e,t){var n=new _n(e,t,"1.0");try{window.dispatchEvent(n)}catch(t){me.log("PublicAPI.broadcastNow("+e+"): error: "+(t.stack?t.stack:t.message))}return n}("apiReady",void 0)})),this.apiReady}},{key:"init",value:function(){var e,t=this;return this.ready=this.initAPI().then((e=function(){var e,n;return t.contextMonitor.start(),t.rulesEngine.run(),t.widgetManager.addEventListeners(),t.widgetManager.showConcierge(),t.widgetManager.fixPosition(t.positionMethod),e=window.navigator.userAgent,n=/MSIE|Trident/.test(e),e.toLowerCase().indexOf("firefox")>-1?window.addEventListener("unload",Au):n?window.addEventListener("beforeunload",Du):window.onpageshow=Nu,zi(t),tr("conciergeReady",void 0),t.loadState="READY",!0},function(){return t.loadState===xu?e():null})),this.ready.catch((function(e){t.loadState="FAILED",t.logError("Concierge Unexpected Error",e),tr("conciergeFailedToLoad",void 0)})),this.ready}}]),t}();function Au(){window.removeEventListener("unload",Au,!1)}function Du(){me.log("Prevent BF Cache"),window.removeEventListener("beforeunload",Du,!1)}function Nu(e){me.log("BackButton: Back Button Listener Added."),e.persisted&&(me.log("BackButton: Persisted state detected. Refreshing."),window.removeEventListener("pageshow",Nu,!1),location.reload())}function Mu(){return function(){var e,t=["JxBrowser","MoxieAgentClient","JavaFX"];for(e=0;e!==t.length;e++)if(-1!==window.navigator.userAgent.indexOf(t[e]))return!1;var n=!1,i=Mr(window.navigator);if(-1!==te(["chrome","firefox","safari","msie","android"],i[0]))if("msie"===i[0]){if(-1!==window.navigator.userAgent.toLowerCase().indexOf("iemobile"))return!1;n=parseInt(i[1])>=11}else n="android"!==i[0]||parseFloat(i[1])>=5;else n=!1;return n}()}function Lu(){var e="Concierge failed to load: ";if(!Mu())throw tr("conciergeFailedToLoad",e+="unsupported browser"),new Error(e);if(!function(){var e=!1;try{e=void 0!==window.localStorage.getItem("MoxieUndefinedKey")}catch(e){me.error(e)}return e}())throw tr("conciergeFailedToLoad",e+="localStorage required"),new Error(e);return!0}function Wu(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Ru(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return mn(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ru(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function Ru(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n1&&void 0!==arguments[1]&&arguments[1]?ju.exec(e):Fu.exec(e),n={query:"",queryKey:{}},i=14;i--;)n[Pu[i]]=t[i]||"";var r,a=Wu(qu(Vu,n.query));try{for(a.s();!(r=a.n()).done;){var o=r.value;o[1]&&(n.queryKey[o[1]]=o[2])}}catch(e){a.e(e)}finally{a.f()}return n}(this.element.src,!1)}},{key:"getTestMode",value:function(){var e=this.getSourceUri();return"true"===(e.queryKey.testmode?e.queryKey.testmode:localStorage.getItem("Moxie_testmode"))}},{key:"getLogFlag",value:function(){var e=this.getSourceUri();return"false"===(e.queryKey.log?e.queryKey.log:localStorage.getItem("Moxie_log"))}},{key:"getBrandId",value:function(){var e=this.getSourceUri();return Number(e.queryKey.brand||"0")}},{key:"getBrandPrefix",value:function(){var e=this.getBrandId();return this.getBrandId()?"/brands/".concat(e):""}},{key:"getAttribute",value:function(e){return this.element.getAttribute(e)}},{key:"getScriptLocation",value:function(){var e=this.getAttribute("data-concierge-script-location");if(e)return e;var t=this.getSourceUri(),n=[t.protocol,"://",t.host];"80"!=t.port&&"443"!=t.port&&t.port&&n.push(":"+t.port);var i=t.path?t.path.split("/").slice(0,-2).join("/"):"";return n.push(i),n.join("")}},{key:"getClientName",value:function(){return this.getAttribute("data-client")?this.getAttribute("data-client"):this.getScriptLocation().match(/([^/]+)$/).pop()}},{key:"getConciergeHost",value:function(){return this.getAttribute("data-concierge-host")?this.getAttribute("data-concierge-host"):"gomoxie.solutions"}},{key:"getConciergeSeparator",value:function(){var e="-",t=this.getSourceUri();return t.queryKey.separator&&(e=t.queryKey.separator),e}},{key:"getDisplayConfiguration",value:function(){var e=this.getAttribute("data-display-config");if(e){var t=JSON.parse(e);if(t&&"object"===i(t))return{positionMethod:t.positionMethod||"css"}}return{positionMethod:"css"}}}],[{key:"getScriptElement",value:function(){for(var e=document.getElementsByTagName("script"),n=0;n